refactor(api): Remove '/api' prefix from frontend API calls and config

- Removed '/api/' prefix from endpoint paths in auth.ts, notifications.ts, oauth.ts, and platform.ts to align with the backend URL reconfiguration.
- Updated 'API_BASE_URL' in config.ts to remove the '/api' suffix, ensuring that API requests are correctly routed to the root of the 'api' subdomain (e.g., http://api.lvh.me:8000/).
- Included improvements to login redirect logic in client.ts.
This commit is contained in:
poduck
2025-12-01 01:48:22 -05:00
parent 2ec78a5237
commit 92724d03b6
5 changed files with 34 additions and 30 deletions

View File

@@ -29,7 +29,7 @@ export const getNotifications = async (params?: { read?: boolean; limit?: number
queryParams.append('limit', String(params.limit));
}
const query = queryParams.toString();
const url = query ? `/api/notifications/?${query}` : '/api/notifications/';
const url = query ? `/notifications/?${query}` : '/notifications/';
const response = await apiClient.get(url);
return response.data;
};
@@ -38,7 +38,7 @@ export const getNotifications = async (params?: { read?: boolean; limit?: number
* Get count of unread notifications
*/
export const getUnreadCount = async (): Promise<number> => {
const response = await apiClient.get<UnreadCountResponse>('/api/notifications/unread_count/');
const response = await apiClient.get<UnreadCountResponse>('/notifications/unread_count/');
return response.data.count;
};
@@ -46,19 +46,19 @@ export const getUnreadCount = async (): Promise<number> => {
* Mark a single notification as read
*/
export const markNotificationRead = async (id: number): Promise<void> => {
await apiClient.post(`/api/notifications/${id}/mark_read/`);
await apiClient.post(`/notifications/${id}/mark_read/`);
};
/**
* Mark all notifications as read
*/
export const markAllNotificationsRead = async (): Promise<void> => {
await apiClient.post('/api/notifications/mark_all_read/');
await apiClient.post('/notifications/mark_all_read/');
};
/**
* Delete all read notifications
*/
export const clearAllNotifications = async (): Promise<void> => {
await apiClient.delete('/api/notifications/clear_all/');
await apiClient.delete('/notifications/clear_all/');
};