Skip to content

Commit 08dda91

Browse files
committed
fix(projects): fix route guard hook onRouteSwitchWhenLoggedIn. fixed #680
1 parent ab6a098 commit 08dda91

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

src/router/guard/route.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,8 @@ async function initRoute(to: RouteLocationNormalized): Promise<RouteLocationRaw
117117
return location;
118118
}
119119

120+
await routeStore.onRouteSwitchWhenLoggedIn();
121+
120122
if (!routeStore.isInitAuthRoute) {
121123
// initialize the auth route
122124
await routeStore.initAuthRoute();
@@ -141,8 +143,6 @@ async function initRoute(to: RouteLocationNormalized): Promise<RouteLocationRaw
141143
// the auth route is initialized
142144
// it is not the "not-found" route, then it is allowed to access
143145
if (!isNotFoundRoute) {
144-
routeStore.onRouteSwitchWhenLoggedIn();
145-
146146
return null;
147147
}
148148

src/store/modules/route/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -311,7 +311,7 @@ export const useRouteStore = defineStore(SetupStoreId.Route, () => {
311311
}
312312

313313
async function onRouteSwitchWhenLoggedIn() {
314-
authStore.initUserInfo();
314+
await authStore.initUserInfo();
315315
}
316316

317317
async function onRouteSwitchWhenNotLoggedIn() {

0 commit comments

Comments
 (0)