fix: 鉴权

feat-search-0611-xwk
向文可 2 years ago
parent 0e4cc662cb
commit cc0c9f8536

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

Loading…
Cancel
Save