Fix jwt-token

This commit is contained in:
2025-08-19 03:40:47 +02:00
parent 7b31d7f5e5
commit c042eed0e9
2 changed files with 13 additions and 5 deletions

View File

@@ -66,6 +66,16 @@ export const AuthProvider = ({ children }) => {
}
}, []);
// Listen for auth logout events from API interceptor
useEffect(() => {
const handleAuthLogout = () => {
dispatch({ type: 'LOGOUT' });
};
window.addEventListener('auth-logout', handleAuthLogout);
return () => window.removeEventListener('auth-logout', handleAuthLogout);
}, []);
const checkAuthStatus = async () => {
try {
dispatch({ type: 'SET_LOADING', payload: true });