fix(projects): add error handle when get routes in dynamic route mode. fixed 440
This commit is contained in:
parent
0774a51525
commit
57b4a9d532
@ -179,15 +179,18 @@ export const useRouteStore = defineStore(SetupStoreId.Route, () => {
|
|||||||
async function initConstantRoute() {
|
async function initConstantRoute() {
|
||||||
if (isInitConstantRoute.value) return;
|
if (isInitConstantRoute.value) return;
|
||||||
|
|
||||||
if (authRouteMode.value === 'static') {
|
const staticRoute = createStaticRoutes();
|
||||||
const staticRoute = createStaticRoutes();
|
|
||||||
|
|
||||||
|
if (authRouteMode.value === 'static') {
|
||||||
addConstantRoutes(staticRoute.constantRoutes);
|
addConstantRoutes(staticRoute.constantRoutes);
|
||||||
} else {
|
} else {
|
||||||
const { data, error } = await fetchGetConstantRoutes();
|
const { data, error } = await fetchGetConstantRoutes();
|
||||||
|
|
||||||
if (!error) {
|
if (!error) {
|
||||||
addConstantRoutes(data);
|
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);
|
handleUpdateRootRouteRedirect(home);
|
||||||
|
|
||||||
setIsInitAuthRoute(true);
|
setIsInitAuthRoute(true);
|
||||||
|
} else {
|
||||||
|
// if fetch user routes failed, reset store
|
||||||
|
authStore.resetStore();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user