Fix jwt-token
This commit is contained in:
@@ -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 });
|
||||
|
||||
Reference in New Issue
Block a user