Improve the design of the frontend 2

This commit is contained in:
Urtzi Alfaro
2025-08-08 23:06:54 +02:00
parent 62ca49d4b8
commit 8af17f1433
12 changed files with 325 additions and 66 deletions

View File

@@ -41,8 +41,16 @@ export const useAuth = () => {
const currentUser = await authService.getCurrentUser();
setUser(currentUser);
} catch (error) {
// Token expired or invalid, clear auth state
logout();
// Token might be expired - let interceptors handle refresh
// Only logout if refresh also fails (handled by ErrorRecoveryInterceptor)
console.log('Token verification failed, interceptors will handle refresh if possible');
// Check if we have a refresh token - if not, logout immediately
const refreshToken = localStorage.getItem(REFRESH_TOKEN_KEY);
if (!refreshToken) {
console.log('No refresh token available, logging out');
logout();
}
}
}
} catch (error) {