Fix jwt-token

This commit is contained in:
2025-08-19 04:06:54 +02:00
parent 3c91415525
commit 0cb59f1b25
2 changed files with 6 additions and 7 deletions

View File

@@ -195,10 +195,9 @@ const MapView = () => {
[maxLat + latPadding, maxLon + lonPadding] // Northeast [maxLat + latPadding, maxLon + lonPadding] // Northeast
]; ];
setMapBounds(bounds); // Only set bounds and center on initial load, not on periodic refreshes
// Only set center on initial load, not on periodic refreshes
if (isInitialLoad) { if (isInitialLoad) {
setMapBounds(bounds);
const centerLat = (minLat + maxLat) / 2; const centerLat = (minLat + maxLat) / 2;
const centerLon = (minLon + maxLon) / 2; const centerLon = (minLon + maxLon) / 2;
setMapCenter([centerLat, centerLon]); setMapCenter([centerLat, centerLon]);

View File

@@ -49,10 +49,10 @@ api.interceptors.response.use(
(response) => response, (response) => response,
(error) => { (error) => {
if (error.response?.status === 401) { if (error.response?.status === 401) {
console.warn('⚠️ 401 Unauthorized detected for:', error.config?.url); // Token expired or invalid - remove token and let ProtectedRoute handle navigation
// Temporarily comment out auto-logout to debug localStorage.removeItem('token');
// localStorage.removeItem('token'); // Force a state update by dispatching a custom event
// window.dispatchEvent(new CustomEvent('auth-logout')); window.dispatchEvent(new CustomEvent('auth-logout'));
} }
return Promise.reject(error); return Promise.reject(error);
} }