Overview
Ship uses TanStack Query v5 with an auto-generated typed API client. The typed client is generated from API endpoints via codegen — no manual hook creation needed. Import the client fromservices/api-client.service:
Queries (GET)
Mutations (POST/PUT/DELETE)
Dynamic Path Params
useApiMutation binds pathParams at hook level — they’re fixed for all mutate() calls. For dynamic IDs (e.g., deleting different items in a list), use endpoint.call() directly:
Query Invalidation
[endpoint.path, ...params]. The first element is always the endpoint path string.
Error Handling
handleApiError(e, setError) from utils:
- Maps server validation errors → react-hook-form field errors
- Shows global errors via Sonner toast
