update auth

This commit is contained in:
Jake Kasper
2025-08-21 11:03:18 -05:00
parent 54a29ebac6
commit 2a7d22e1c8
2 changed files with 7 additions and 3 deletions

View File

@@ -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');