Web
Calling API
Overview
Ship uses TanStack Query with our own axios library wrapper.
All queries are located in the /resources
folder, organized into sub-folders for each resource.
TanStack Query helps easily fetch, cache, and update data. Each API endpoint has a related React hook using TanStack Query.
When getting data with apiService in services/api.service.ts
, no need to add the full endpoint URL.
The axios instance already has the base URL set.
If you need to make a request to a new endpoint, for example, for a project
resource,
you need to add a new hook to /resources/project/project.api.ts
Examples
resources/account/account.api.ts
resources/user/user.api.ts
pages/profile/index.page.tsx
pages/home/index.tsx