mirror of
https://github.com/Cccc-owo/CheckInApp.git
synced 2026-06-17 05:56:29 +00:00
fix(navbar): stop token monitor on logout
Add stopMonitoring() call in handleLogout to prevent memory leak from timer continuing after user logs out.
This commit is contained in:
@@ -318,7 +318,7 @@ const route = useRoute();
|
|||||||
const authStore = useAuthStore();
|
const authStore = useAuthStore();
|
||||||
const userStore = useUserStore();
|
const userStore = useUserStore();
|
||||||
const { isMobile } = useBreakpoint();
|
const { isMobile } = useBreakpoint();
|
||||||
const { getRemainingMinutes, tokenStatus } = useTokenMonitor();
|
const { getRemainingMinutes, tokenStatus, stopMonitoring } = useTokenMonitor();
|
||||||
const { isDark, toggleTheme } = useTheme();
|
const { isDark, toggleTheme } = useTheme();
|
||||||
|
|
||||||
const drawerVisible = ref(false);
|
const drawerVisible = ref(false);
|
||||||
@@ -436,6 +436,10 @@ const handleLogout = () => {
|
|||||||
okText: '确定',
|
okText: '确定',
|
||||||
cancelText: '取消',
|
cancelText: '取消',
|
||||||
onOk() {
|
onOk() {
|
||||||
|
// 停止 token 监控
|
||||||
|
stopMonitoring();
|
||||||
|
|
||||||
|
// 清除登录状态
|
||||||
authStore.logout();
|
authStore.logout();
|
||||||
router.push('/login');
|
router.push('/login');
|
||||||
drawerVisible.value = false;
|
drawerVisible.value = false;
|
||||||
|
|||||||
Reference in New Issue
Block a user