API Communication & useApi
All communication with the backend is centralized through the useApi composable (composables/useApi.ts).
Key Features:
- Sanctum Client: It wraps
useSanctumClient(), ensuring all outgoing requests are automatically authenticated and include required CSRF tokens. - Localization Awareness: Automatically injects a
Langheader on every request, derived from the current active locale in the store or cookies. - Automatic Retries: Implemented with exponential backoff for
429(Rate Limit) and500(Server Error) responses. - Standardized Headers: Ensures
Accept: application/jsonand correctContent-Typefor both JSON andFormDatapayloads. - Maintenance Mode: Automatically detects
503status codes and triggers a global maintenance state.