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);