Fix double /api/ prefix in API endpoint calls

When VITE_API_URL=/api, axios baseURL is already set to /api. However, all endpoint calls included the /api/ prefix, creating double paths like /api/api/auth/login/.

Removed /api/ prefix from 81 API endpoint calls across 22 files:
- src/api/auth.ts - Fixed login, logout, me, refresh, hijack endpoints
- src/api/client.ts - Fixed token refresh endpoint
- src/api/profile.ts - Fixed all profile, email, password, MFA, sessions endpoints
- src/hooks/*.ts - Fixed all remaining API calls (users, appointments, resources, etc)
- src/pages/*.tsx - Fixed signup and email verification endpoints

This ensures API requests use the correct path: /api/auth/login/ instead of /api/api/auth/login/

🤖 Generated with Claude Code

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
poduck
2025-11-30 15:27:57 -05:00
parent f1d4dac9d2
commit 4cd6610f2a
53 changed files with 476 additions and 687 deletions

View File

@@ -20,7 +20,7 @@ export const useResources = (filters?: ResourceFilters) => {
const params = new URLSearchParams();
if (filters?.type) params.append('type', filters.type);
const { data } = await apiClient.get(`/api/resources/?${params}`);
const { data } = await apiClient.get(`/resources/?${params}`);
// Transform backend format to frontend format
return data.map((r: any) => ({
@@ -42,7 +42,7 @@ export const useResource = (id: string) => {
return useQuery<Resource>({
queryKey: ['resources', id],
queryFn: async () => {
const { data } = await apiClient.get(`/api/resources/${id}/`);
const { data } = await apiClient.get(`/resources/${id}/`);
return {
id: String(data.id),
@@ -72,7 +72,7 @@ export const useCreateResource = () => {
timezone: 'UTC', // Default timezone
};
const { data } = await apiClient.post('/api/resources/', backendData);
const { data } = await apiClient.post('/resources/', backendData);
return data;
},
onSuccess: () => {
@@ -102,7 +102,7 @@ export const useUpdateResource = () => {
backendData.saved_lane_count = updates.savedLaneCount;
}
const { data } = await apiClient.patch(`/api/resources/${id}/`, backendData);
const { data } = await apiClient.patch(`/resources/${id}/`, backendData);
return data;
},
onSuccess: () => {
@@ -119,7 +119,7 @@ export const useDeleteResource = () => {
return useMutation({
mutationFn: async (id: string) => {
await apiClient.delete(`/api/resources/${id}/`);
await apiClient.delete(`/resources/${id}/`);
},
onSuccess: () => {
queryClient.invalidateQueries({ queryKey: ['resources'] });