Merge pull request #386 from paynezhuang/main

This commit is contained in:
Soybean 2024-04-15 16:27:08 +08:00 committed by GitHub
commit cb8ea2531d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 5 additions and 3 deletions

View File

@ -92,7 +92,6 @@ export function useRouterPush(inSetup = true) {
}
return {
route,
routerPush,
routerBack,
routerPushByKey,

View File

@ -1,6 +1,7 @@
import { computed, reactive, ref } from 'vue';
import { defineStore } from 'pinia';
import { useLoading } from '@sa/hooks';
import { useRoute } from 'vue-router';
import { SetupStoreId } from '@/enum';
import { useRouterPush } from '@/hooks/common/router';
import { fetchGetUserInfo, fetchLogin } from '@/service/api';
@ -11,9 +12,11 @@ import { clearAuthStorage, getToken, getUserInfo } from './shared';
export const useAuthStore = defineStore(SetupStoreId.Auth, () => {
const routeStore = useRouteStore();
const { route, toLogin, redirectFromLogin } = useRouterPush(false);
const { toLogin, redirectFromLogin } = useRouterPush(false);
const { loading: loginLoading, startLoading, endLoading } = useLoading();
const route = useRoute();
const token = ref(getToken());
const userInfo: Api.Auth.UserInfo = reactive(getUserInfo());
@ -36,7 +39,7 @@ export const useAuthStore = defineStore(SetupStoreId.Auth, () => {
authStore.$reset();
if (!route.value.meta.constant) {
if (!route.meta.constant) {
await toLogin();
}