From 48a69c8b4b332434bd90bf2cad606b0ffe7e787e Mon Sep 17 00:00:00 2001 From: caiyuchao Date: Wed, 8 Jan 2025 19:24:09 +0800 Subject: [PATCH] =?UTF-8?q?fix=EF=BC=9A=E4=BF=AE=E5=A4=8D=E7=99=BB?= =?UTF-8?q?=E5=BD=95=E8=8F=9C=E5=8D=95=E4=B8=8D=E5=88=B7=E6=96=B0=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/store/modules/route/index.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) 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));