Fix jwt-token
This commit is contained in:
@@ -195,10 +195,9 @@ const MapView = () => {
|
||||
[maxLat + latPadding, maxLon + lonPadding] // Northeast
|
||||
];
|
||||
|
||||
setMapBounds(bounds);
|
||||
|
||||
// Only set center on initial load, not on periodic refreshes
|
||||
// Only set bounds and center on initial load, not on periodic refreshes
|
||||
if (isInitialLoad) {
|
||||
setMapBounds(bounds);
|
||||
const centerLat = (minLat + maxLat) / 2;
|
||||
const centerLon = (minLon + maxLon) / 2;
|
||||
setMapCenter([centerLat, centerLon]);
|
||||
|
||||
@@ -49,10 +49,10 @@ api.interceptors.response.use(
|
||||
(response) => response,
|
||||
(error) => {
|
||||
if (error.response?.status === 401) {
|
||||
console.warn('⚠️ 401 Unauthorized detected for:', error.config?.url);
|
||||
// Temporarily comment out auto-logout to debug
|
||||
// localStorage.removeItem('token');
|
||||
// window.dispatchEvent(new CustomEvent('auth-logout'));
|
||||
// Token expired or invalid - remove token and let ProtectedRoute handle navigation
|
||||
localStorage.removeItem('token');
|
||||
// Force a state update by dispatching a custom event
|
||||
window.dispatchEvent(new CustomEvent('auth-logout'));
|
||||
}
|
||||
return Promise.reject(error);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user