From f5e6a205b3e3eab6b60a75c8ea04a8b3b50c3cc6 Mon Sep 17 00:00:00 2001 From: Soybean Date: Mon, 9 Jun 2025 22:32:17 +0800 Subject: [PATCH] fix(auth): initialize routeStore in toggle-auth. closed #754 --- src/store/modules/auth/index.ts | 3 +-- src/views/function/toggle-auth/index.vue | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/src/store/modules/auth/index.ts b/src/store/modules/auth/index.ts index b18e1e6b..71d10a97 100644 --- a/src/store/modules/auth/index.ts +++ b/src/store/modules/auth/index.ts @@ -13,6 +13,7 @@ import { clearAuthStorage, getToken } from './shared'; export const useAuthStore = defineStore(SetupStoreId.Auth, () => { const route = useRoute(); + const authStore = useAuthStore(); const routeStore = useRouteStore(); const tabStore = useTabStore(); const { toLogin, redirectFromLogin } = useRouterPush(false); @@ -39,8 +40,6 @@ export const useAuthStore = defineStore(SetupStoreId.Auth, () => { /** Reset auth store */ async function resetStore() { - const authStore = useAuthStore(); - clearAuthStorage(); authStore.$reset(); diff --git a/src/views/function/toggle-auth/index.vue b/src/views/function/toggle-auth/index.vue index e3af4dd5..97b5da57 100644 --- a/src/views/function/toggle-auth/index.vue +++ b/src/views/function/toggle-auth/index.vue @@ -2,11 +2,11 @@ import { computed, ref } from 'vue'; import { useRoute } from 'vue-router'; import { useLoading } from '@sa/hooks'; -import { $t } from '@/locales'; import { useAppStore } from '@/store/modules/app'; import { useAuthStore } from '@/store/modules/auth'; import { useTabStore } from '@/store/modules/tab'; import { useAuth } from '@/hooks/business/auth'; +import { $t } from '@/locales'; const route = useRoute(); const appStore = useAppStore();