diff --git a/src/store/modules/route/index.ts b/src/store/modules/route/index.ts index ac2715c..f527307 100644 --- a/src/store/modules/route/index.ts +++ b/src/store/modules/route/index.ts @@ -46,7 +46,9 @@ export const useRouteStore = defineStore(SetupStoreId.Route, () => { const authRoutes = shallowRef([]); function addAuthRoutes(routes: ElegantConstRoute[]) { - const authRoutesMap = new Map(authRoutes.value.map(route => [route.name, route])); + const {constantRoutes} = createStaticRoutes(); + + const authRoutesMap = new Map(constantRoutes.map(route => [route.name, route])); routes.forEach(route => { authRoutesMap.set(route.name, route); @@ -160,7 +162,7 @@ export const useRouteStore = defineStore(SetupStoreId.Route, () => { const {data: routes, error} = await doGetUserRoutes(); if (!error) { - const {authRoutes: staticAuthRoutes} = createStaticRoutes(); + const {authRoutes: staticAuthRoutes} = createStaticRoutes(); const filteredAuthRoutes = filterAuthRoutesByRoles(staticAuthRoutes, authStore.userInfo.roles ?? []); addAuthRoutes(filteredAuthRoutes.concat(routes));