fix: redirect to /login after logout

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
emil
2026-05-01 16:46:16 +03:00
co-authored by Claude Sonnet 4.6
parent be2260d259
commit b3f9655cf7
+3 -1
View File
@@ -51,10 +51,12 @@ export const useAuthStore = create<AuthState>()(
if (typeof window !== 'undefined') {
localStorage.removeItem('access_token');
localStorage.removeItem('refresh_token');
// Clear the auth cookie so middleware stops treating this session as logged in.
document.cookie = 'access_token=; path=/; max-age=0';
}
set({ accessToken: null, refreshToken: null, user: null });
if (typeof window !== 'undefined') {
window.location.href = '/login';
}
},
}),
{ name: 'cu-points-auth' }