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:
chamikaJ
2025-07-15 16:11:30 +05:30
parent 833879e0e8
commit 737f7cada2

View File

@@ -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());
});
}
};
@@ -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());
});
}
};