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

@@ -88,11 +88,15 @@ apiClient.interceptors.response.use(
return apiClient(originalRequest);
}
} catch (refreshError) {
// Refresh failed - clear tokens and redirect to login
// Refresh failed - clear tokens and redirect to login on root domain
const { deleteCookie } = await import('../utils/cookies');
const { getBaseDomain } = await import('../utils/domain');
deleteCookie('access_token');
deleteCookie('refresh_token');
window.location.href = '/login';
const protocol = window.location.protocol;
const baseDomain = getBaseDomain();
const port = window.location.port ? `:${window.location.port}` : '';
window.location.href = `${protocol}//${baseDomain}${port}/login`;
return Promise.reject(refreshError);
}
}