🐞 fix:修复从“同时使用了用户信息和权限判断”的页面退出登录时异常问题

This commit is contained in:
preschooler
2024-10-29 12:35:44 +08:00
parent c1924d566f
commit 9b290ae3ce
5 changed files with 15 additions and 9 deletions

View File

@@ -35,8 +35,9 @@ export const usePermissionStore = defineStore('permission', {
return new Promise<void>(async (resolve) => {
// 获得菜单列表它在登录的时候setUserInfoAction 方法中已经进行获取
let res: AppCustomRouteRecordRaw[] = []
if (wsCache.get(CACHE_KEY.ROLE_ROUTERS)) {
res = wsCache.get(CACHE_KEY.ROLE_ROUTERS) as AppCustomRouteRecordRaw[]
const roleRouters = wsCache.get(CACHE_KEY.ROLE_ROUTERS)
if (roleRouters) {
res = roleRouters as AppCustomRouteRecordRaw[]
}
const routerMap: AppRouteRecordRaw[] = generateRoute(res)
// 动态路由404一定要放到最后面