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:
@@ -64,7 +64,7 @@ export interface User {
|
||||
* Login user
|
||||
*/
|
||||
export const login = async (credentials: LoginCredentials): Promise<LoginResponse> => {
|
||||
const response = await apiClient.post<LoginResponse>('/api/auth/login/', credentials);
|
||||
const response = await apiClient.post<LoginResponse>('/auth/login/', credentials);
|
||||
return response.data;
|
||||
};
|
||||
|
||||
@@ -72,14 +72,14 @@ export const login = async (credentials: LoginCredentials): Promise<LoginRespons
|
||||
* Logout user
|
||||
*/
|
||||
export const logout = async (): Promise<void> => {
|
||||
await apiClient.post('/api/auth/logout/');
|
||||
await apiClient.post('/auth/logout/');
|
||||
};
|
||||
|
||||
/**
|
||||
* Get current user
|
||||
*/
|
||||
export const getCurrentUser = async (): Promise<User> => {
|
||||
const response = await apiClient.get<User>('/api/auth/me/');
|
||||
const response = await apiClient.get<User>('/auth/me/');
|
||||
return response.data;
|
||||
};
|
||||
|
||||
@@ -87,7 +87,7 @@ export const getCurrentUser = async (): Promise<User> => {
|
||||
* Refresh access token
|
||||
*/
|
||||
export const refreshToken = async (refresh: string): Promise<{ access: string }> => {
|
||||
const response = await apiClient.post('/api/auth/refresh/', { refresh });
|
||||
const response = await apiClient.post('/auth/refresh/', { refresh });
|
||||
return response.data;
|
||||
};
|
||||
|
||||
@@ -99,7 +99,7 @@ export const masquerade = async (
|
||||
hijack_history?: MasqueradeStackEntry[]
|
||||
): Promise<LoginResponse> => {
|
||||
const response = await apiClient.post<LoginResponse>(
|
||||
'/api/auth/hijack/acquire/',
|
||||
'/auth/hijack/acquire/',
|
||||
{ user_pk, hijack_history }
|
||||
);
|
||||
return response.data;
|
||||
@@ -112,7 +112,7 @@ export const stopMasquerade = async (
|
||||
masquerade_stack: MasqueradeStackEntry[]
|
||||
): Promise<LoginResponse> => {
|
||||
const response = await apiClient.post<LoginResponse>(
|
||||
'/api/auth/hijack/release/',
|
||||
'/auth/hijack/release/',
|
||||
{ masquerade_stack }
|
||||
);
|
||||
return response.data;
|
||||
|
||||
Reference in New Issue
Block a user