Allow recovery from dream creation failures
CreateDream awaits api.post and navigates on success, but has no try/catch or submission state. The form stays enabled during the request. The API has validation middleware, so failures need to be shown without losing the entered text.
- Estimated size
- S · 3–5 hours
- Skills
- React · TypeScript · Axios
Files and evidence
- YagoLagrottiBracco/dreamerz-front/src/components/pages/dream/CreateDream.tsxTarget file ·
51efb503a97a· L49–L125 - YagoLagrottiBracco/dreamerz-api/src/routes/private.routes.tsContext ·
541490969f04· L37–L42 - YagoLagrottiBracco/dreamerz-api/src/app/middlewares/dreamMiddleware.tsContext ·
541490969f04· L3–L7
Step-by-step acceptance criteria
- Simulate a validation response and a network failure; catch submission errors and show an accessible message in the form.
- Keep the name and description after failure and allow retry; do not navigate to the list when creation fails.
- Disable submission while the request is pending and prevent repeated clicks from creating duplicate requests.
- Test failure, retry and a 201 response: success must make one request and navigate to /dashboard/dreams.