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