optimize(projects): optimize router guard

This commit is contained in:
Soybean
2024-12-11 12:11:15 +08:00
parent ba38119efd
commit 0dfcf18b64
2 changed files with 2 additions and 4 deletions

View File

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