mirror of
				https://github.com/soybeanjs/soybean-admin.git
				synced 2025-11-04 15:53:43 +08:00 
			
		
		
		
	optimize(projects): optimize router guard
This commit is contained in:
		@@ -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) {
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user