fix(projects): fix route guard hook onRouteSwitchWhenLoggedIn
. fixed #680
This commit is contained in:
parent
5c6ab0b595
commit
ab9858c7d0
@ -117,6 +117,8 @@ async function initRoute(to: RouteLocationNormalized): Promise<RouteLocationRaw
|
|||||||
return location;
|
return location;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
await routeStore.onRouteSwitchWhenLoggedIn();
|
||||||
|
|
||||||
if (!routeStore.isInitAuthRoute) {
|
if (!routeStore.isInitAuthRoute) {
|
||||||
// initialize the auth route
|
// initialize the auth route
|
||||||
await routeStore.initAuthRoute();
|
await routeStore.initAuthRoute();
|
||||||
@ -141,8 +143,6 @@ async function initRoute(to: RouteLocationNormalized): Promise<RouteLocationRaw
|
|||||||
// the auth route is initialized
|
// the auth route is initialized
|
||||||
// it is not the "not-found" route, then it is allowed to access
|
// it is not the "not-found" route, then it is allowed to access
|
||||||
if (!isNotFoundRoute) {
|
if (!isNotFoundRoute) {
|
||||||
routeStore.onRouteSwitchWhenLoggedIn();
|
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -311,7 +311,7 @@ export const useRouteStore = defineStore(SetupStoreId.Route, () => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async function onRouteSwitchWhenLoggedIn() {
|
async function onRouteSwitchWhenLoggedIn() {
|
||||||
authStore.initUserInfo();
|
await authStore.initUserInfo();
|
||||||
}
|
}
|
||||||
|
|
||||||
async function onRouteSwitchWhenNotLoggedIn() {
|
async function onRouteSwitchWhenNotLoggedIn() {
|
||||||
|
Loading…
Reference in New Issue
Block a user