diff --git a/frontend/src/api/client.ts b/frontend/src/api/client.ts index c11096f..5e31bbf 100644 --- a/frontend/src/api/client.ts +++ b/frontend/src/api/client.ts @@ -55,11 +55,8 @@ class ApiClient { }); if (!response.ok) { - if (response.status === 401) { - const path = window.location.pathname; - if (path !== '/login' && path !== '/register') { - window.location.href = '/login'; - } + if (response.status === 401 && !url.includes('/auth/')) { + window.location.href = '/login'; throw { status: 401, message: 'Session expired' } satisfies ApiError; } diff --git a/frontend/src/api/syntheses.ts b/frontend/src/api/syntheses.ts index 5483aef..fa5f7c7 100644 --- a/frontend/src/api/syntheses.ts +++ b/frontend/src/api/syntheses.ts @@ -45,10 +45,7 @@ export async function fetchFile(path: string): Promise { if (!response.ok) { if (response.status === 401) { - const path = window.location.pathname; - if (path !== '/login' && path !== '/register') { - window.location.href = '/login'; - } + window.location.href = '/login'; } const errorBody = await response.json().catch(() => ({ error: 'Unknown error' })); throw {