Commit 6a8820597fb58ef7cda7ead59f5cbb4c72c0f882
1 parent
b7ea68e6
fix: ensure that the 401 jumps to the login page correctly, fix #512
Showing
1 changed file
with
5 additions
and
2 deletions
src/store/modules/permission.ts
@@ -117,14 +117,17 @@ export const usePermissionStore = defineStore({ | @@ -117,14 +117,17 @@ export const usePermissionStore = defineStore({ | ||
117 | 117 | ||
118 | // !Simulate to obtain permission codes from the background, | 118 | // !Simulate to obtain permission codes from the background, |
119 | // this function may only need to be executed once, and the actual project can be put at the right time by itself | 119 | // this function may only need to be executed once, and the actual project can be put at the right time by itself |
120 | + let routeList: AppRouteRecordRaw[] = []; | ||
120 | try { | 121 | try { |
121 | this.changePermissionCode('1'); | 122 | this.changePermissionCode('1'); |
122 | - } catch (error) {} | 123 | + routeList = (await getMenuListById({ id: paramId })) as AppRouteRecordRaw[]; |
124 | + } catch (error) { | ||
125 | + console.error(error); | ||
126 | + } | ||
123 | 127 | ||
124 | if (!paramId) { | 128 | if (!paramId) { |
125 | throw new Error('paramId is undefined!'); | 129 | throw new Error('paramId is undefined!'); |
126 | } | 130 | } |
127 | - let routeList = (await getMenuListById({ id: paramId })) as AppRouteRecordRaw[]; | ||
128 | 131 | ||
129 | // Dynamically introduce components | 132 | // Dynamically introduce components |
130 | routeList = transformObjToRoute(routeList); | 133 | routeList = transformObjToRoute(routeList); |