mirror of
				https://github.com/soybeanjs/soybean-admin.git
				synced 2025-11-04 15:53:43 +08:00 
			
		
		
		
	fix(projects): add error handle when get routes in dynamic route mode. fixed 440
This commit is contained in:
		@@ -179,15 +179,18 @@ export const useRouteStore = defineStore(SetupStoreId.Route, () => {
 | 
			
		||||
  async function initConstantRoute() {
 | 
			
		||||
    if (isInitConstantRoute.value) return;
 | 
			
		||||
 | 
			
		||||
    if (authRouteMode.value === 'static') {
 | 
			
		||||
      const staticRoute = createStaticRoutes();
 | 
			
		||||
    const staticRoute = createStaticRoutes();
 | 
			
		||||
 | 
			
		||||
    if (authRouteMode.value === 'static') {
 | 
			
		||||
      addConstantRoutes(staticRoute.constantRoutes);
 | 
			
		||||
    } else {
 | 
			
		||||
      const { data, error } = await fetchGetConstantRoutes();
 | 
			
		||||
 | 
			
		||||
      if (!error) {
 | 
			
		||||
        addConstantRoutes(data);
 | 
			
		||||
      } else {
 | 
			
		||||
        // if fetch constant routes failed, use static constant routes
 | 
			
		||||
        addConstantRoutes(staticRoute.constantRoutes);
 | 
			
		||||
      }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
@@ -240,6 +243,9 @@ export const useRouteStore = defineStore(SetupStoreId.Route, () => {
 | 
			
		||||
      handleUpdateRootRouteRedirect(home);
 | 
			
		||||
 | 
			
		||||
      setIsInitAuthRoute(true);
 | 
			
		||||
    } else {
 | 
			
		||||
      // if fetch user routes failed, reset store
 | 
			
		||||
      authStore.resetStore();
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user