From cc0c9f8536150ef525ea698cea83523e2e383a55 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=90=91=E6=96=87=E5=8F=AF?= <1041367524@qq.com> Date: Fri, 10 Jun 2022 15:12:22 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E9=89=B4=E6=9D=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/router/index.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/router/index.js b/src/router/index.js index b6fc752..c559595 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -59,14 +59,15 @@ router.onError((error, to) => { router.beforeEach(async (to, from, next) => { if (store.state.local.token) { if (!store.state.auth.permission.length) { - let res = true; - res &= await store.dispatch('auth/getUserInfo'); + let res1 = true, + res2 = true; + res1 = await store.dispatch('auth/getUserInfo'); if (config.useLocalRouter) { store.commit('auth/setPermission', routes); } else { - res &= await store.dispatch('auth/getPermission'); + res2 = await store.dispatch('auth/getPermission'); } - if (res) { + if (res1 && res2) { next({ ...to, replace: true }); } else { next(false);