diff --git a/frontend/src/api/client.ts b/frontend/src/api/client.ts index fad5ce9..c11096f 100644 --- a/frontend/src/api/client.ts +++ b/frontend/src/api/client.ts @@ -56,7 +56,10 @@ class ApiClient { if (!response.ok) { if (response.status === 401) { - window.location.href = '/login'; + const path = window.location.pathname; + if (path !== '/login' && path !== '/register') { + 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 fa5f7c7..5483aef 100644 --- a/frontend/src/api/syntheses.ts +++ b/frontend/src/api/syntheses.ts @@ -45,7 +45,10 @@ export async function fetchFile(path: string): Promise { if (!response.ok) { if (response.status === 401) { - window.location.href = '/login'; + const path = window.location.pathname; + if (path !== '/login' && path !== '/register') { + window.location.href = '/login'; + } } const errorBody = await response.json().catch(() => ({ error: 'Unknown error' })); throw {