refactor(App): streamline cache cleanup process on logout
- Removed dynamic import of CacheCleanup in the App component, directly utilizing the imported utility for clearing caches and reloading the application on user logout. - This change simplifies the logout process and improves code readability.
This commit is contained in:
@@ -14,6 +14,7 @@ import router from './app/routes';
|
||||
import { useAppSelector } from './hooks/useAppSelector';
|
||||
import { initMixpanel } from './utils/mixpanelInit';
|
||||
import { initializeCsrfToken } from './api/api-client';
|
||||
import CacheCleanup from './utils/cache-cleanup';
|
||||
|
||||
// Types & Constants
|
||||
import { Language } from './features/i18n/localesSlice';
|
||||
@@ -129,11 +130,9 @@ const App: React.FC = memo(() => {
|
||||
event.preventDefault(); // Prevent default browser error handling
|
||||
|
||||
// Clear caches and reload
|
||||
import('./utils/cache-cleanup').then(({ default: CacheCleanup }) => {
|
||||
CacheCleanup.clearAllCaches()
|
||||
.then(() => CacheCleanup.forceReload('/auth/login'))
|
||||
.catch(() => window.location.reload());
|
||||
});
|
||||
CacheCleanup.clearAllCaches()
|
||||
.then(() => CacheCleanup.forceReload('/auth/login'))
|
||||
.catch(() => window.location.reload());
|
||||
}
|
||||
};
|
||||
|
||||
@@ -150,11 +149,9 @@ const App: React.FC = memo(() => {
|
||||
event.preventDefault(); // Prevent default browser error handling
|
||||
|
||||
// Clear caches and reload
|
||||
import('./utils/cache-cleanup').then(({ default: CacheCleanup }) => {
|
||||
CacheCleanup.clearAllCaches()
|
||||
.then(() => CacheCleanup.forceReload('/auth/login'))
|
||||
.catch(() => window.location.reload());
|
||||
});
|
||||
CacheCleanup.clearAllCaches()
|
||||
.then(() => CacheCleanup.forceReload('/auth/login'))
|
||||
.catch(() => window.location.reload());
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user