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;
|
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();
|
||||||
@ -140,6 +138,8 @@ async function initRoute(to: RouteLocationNormalized): Promise<RouteLocationRaw
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
routeStore.onRouteSwitchWhenLoggedIn();
|
||||||
|
|
||||||
// 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) {
|
||||||
|
@ -69,8 +69,6 @@ export const useAuthStore = defineStore(SetupStoreId.Auth, () => {
|
|||||||
const pass = await loginByToken(loginToken);
|
const pass = await loginByToken(loginToken);
|
||||||
|
|
||||||
if (pass) {
|
if (pass) {
|
||||||
await routeStore.initAuthRoute();
|
|
||||||
|
|
||||||
await redirectFromLogin(redirect);
|
await redirectFromLogin(redirect);
|
||||||
|
|
||||||
if (routeStore.isInitAuthRoute) {
|
if (routeStore.isInitAuthRoute) {
|
||||||
|
Loading…
Reference in New Issue
Block a user