fix login

This commit is contained in:
itqop 2025-12-31 03:02:29 +03:00
parent 4c51d45708
commit 36a363a2f0
1 changed files with 4 additions and 1 deletions

View File

@ -41,7 +41,10 @@ class ApiClient {
if (error.response?.status === 401) {
localStorage.removeItem('access_token');
localStorage.removeItem('refresh_token');
window.location.href = '/login';
// Redirect only if not already on login/register page
if (!['/login', '/register'].includes(window.location.pathname)) {
window.location.href = '/login';
}
}
return Promise.reject(error);
}