update auth
This commit is contained in:
@@ -35,7 +35,10 @@ apiClient.interceptors.response.use(
|
||||
if (error.response?.status === 401) {
|
||||
// Unauthorized - clear token and redirect to login
|
||||
localStorage.removeItem('authToken');
|
||||
window.location.href = '/login';
|
||||
// Use React Router navigation instead of hard redirect
|
||||
if (window.location.pathname !== '/login' && window.location.pathname !== '/register') {
|
||||
window.location.href = '/login';
|
||||
}
|
||||
} else if (error.response?.status === 403) {
|
||||
// Forbidden
|
||||
toast.error('You do not have permission to perform this action');
|
||||
|
||||
Reference in New Issue
Block a user