fix(projects): fix route guard hook onRouteSwitchWhenLoggedIn. fixed #680

This commit is contained in:
Soybean 2024-12-10 12:45:00 +08:00
parent 5c6ab0b595
commit ab9858c7d0
2 changed files with 3 additions and 3 deletions

View File

@ -117,6 +117,8 @@ async function initRoute(to: RouteLocationNormalized): Promise<RouteLocationRaw
return location;
}
await routeStore.onRouteSwitchWhenLoggedIn();
if (!routeStore.isInitAuthRoute) {
// initialize the auth route
await routeStore.initAuthRoute();
@ -141,8 +143,6 @@ async function initRoute(to: RouteLocationNormalized): Promise<RouteLocationRaw
// the auth route is initialized
// it is not the "not-found" route, then it is allowed to access
if (!isNotFoundRoute) {
routeStore.onRouteSwitchWhenLoggedIn();
return null;
}

View File

@ -311,7 +311,7 @@ export const useRouteStore = defineStore(SetupStoreId.Route, () => {
}
async function onRouteSwitchWhenLoggedIn() {
authStore.initUserInfo();
await authStore.initUserInfo();
}
async function onRouteSwitchWhenNotLoggedIn() {