diff --git a/frontend/src/functions/APIClient.ts b/frontend/src/functions/APIClient.ts index 427e2ed0..21a5e734 100644 --- a/frontend/src/functions/APIClient.ts +++ b/frontend/src/functions/APIClient.ts @@ -3,6 +3,7 @@ import getApiUrl from '../configuration/getApiUrl'; import getFetchCredentials from '../configuration/getFetchCredentials'; import logOut from '../api/actions/logOut'; import getCookie from './getCookie'; +import Routes from '../configuration/routes/RouteList'; export interface ApiClientOptions extends Omit { method?: 'GET' | 'POST' | 'PUT' | 'DELETE'; @@ -31,13 +32,13 @@ const APIClient = async ( // Handle common errors if (response.status === 401) { logOut(); - window.location.href = '/login'; + window.location.href = Routes.Login; throw new Error('Unauthorized: Redirecting to login.'); } if (response.status === 403) { logOut(); - window.location.href = '/login'; + window.location.href = Routes.Login; throw new Error('Forbidden: Access denied.'); }