fix:修复登录菜单不刷新问题
This commit is contained in:
@@ -46,7 +46,9 @@ export const useRouteStore = defineStore(SetupStoreId.Route, () => {
|
||||
const authRoutes = shallowRef<ElegantConstRoute[]>([]);
|
||||
|
||||
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));
|
||||
|
||||
|
||||
Reference in New Issue
Block a user