16 lines
698 B
Markdown
16 lines
698 B
Markdown
# Frontend API Instructions
|
|
|
|
## Scope
|
|
- Applies to API calls in `src/lib/api/api.ts` and feature-level data hooks.
|
|
|
|
## Rules
|
|
- Keep axios-based API calls centralized in `src/lib/api/api.ts`.
|
|
- Map backend response shapes to frontend-friendly models in hooks or API mappers.
|
|
- Follow existing tickets pattern: `api.ts` + feature hook (`useX`) + presentational components.
|
|
- Use optimistic updates carefully; ensure API failures do not leave inconsistent UI state.
|
|
- Keep request payload keys aligned with backend contract (`section_id`, `position`, etc.).
|
|
|
|
## Error Handling
|
|
- Surface recoverable errors to the user with clear toast messages.
|
|
- Avoid silent failures for create/update/delete flows.
|