optimize(projects): optimize router guard
This commit is contained in:
parent
ba38119efd
commit
0dfcf18b64
@ -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) {
|
||||
|
@ -69,8 +69,6 @@ export const useAuthStore = defineStore(SetupStoreId.Auth, () => {
|
||||
const pass = await loginByToken(loginToken);
|
||||
|
||||
if (pass) {
|
||||
await routeStore.initAuthRoute();
|
||||
|
||||
await redirectFromLogin(redirect);
|
||||
|
||||
if (routeStore.isInitAuthRoute) {
|
||||
|
Loading…
Reference in New Issue
Block a user