From 6a8820597fb58ef7cda7ead59f5cbb4c72c0f882 Mon Sep 17 00:00:00 2001 From: Vben Date: Sat, 24 Apr 2021 20:31:05 +0800 Subject: [PATCH] fix: ensure that the 401 jumps to the login page correctly, fix #512 --- src/store/modules/permission.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/store/modules/permission.ts b/src/store/modules/permission.ts index 34f82142..bdabc7e4 100644 --- a/src/store/modules/permission.ts +++ b/src/store/modules/permission.ts @@ -117,14 +117,17 @@ export const usePermissionStore = defineStore({ // !Simulate to obtain permission codes from the background, // this function may only need to be executed once, and the actual project can be put at the right time by itself + let routeList: AppRouteRecordRaw[] = []; try { this.changePermissionCode('1'); - } catch (error) {} + routeList = (await getMenuListById({ id: paramId })) as AppRouteRecordRaw[]; + } catch (error) { + console.error(error); + } if (!paramId) { throw new Error('paramId is undefined!'); } - let routeList = (await getMenuListById({ id: paramId })) as AppRouteRecordRaw[]; // Dynamically introduce components routeList = transformObjToRoute(routeList); -- GitLab