fix: BUG修改
This commit is contained in:
parent
56a6c86836
commit
1ff420c61a
@ -80,8 +80,10 @@ class RequestHttp {
|
||||
if (error.message.indexOf("Network Error") !== -1) ElMessage.error("网络错误!请您稍后重试");
|
||||
if (error.message.indexOf("Request failed with status code 401") !== -1) {
|
||||
// ElMessage.error("登录已过期,请重新登录");
|
||||
// ElMessage.error("登录信息异常,请刷新或重新登录!");
|
||||
globalStore.resetStore();
|
||||
router.replace(LOGIN_URL);
|
||||
// router.replace(LOGIN_URL);
|
||||
router.replace("/load");
|
||||
}
|
||||
// 根据响应的错误状态码,做不同的处理
|
||||
// if (response) checkStatus(response.status);
|
||||
|
||||
@ -56,7 +56,8 @@ router.beforeEach(async (to, from, next) => {
|
||||
if (ROUTER_WHITE_LIST.includes(to.path)) return next();
|
||||
|
||||
// 5.判断是否有 Token,没有重定向到 login
|
||||
if (!globalStore.token) return next({ path: LOGIN_URL, replace: true });
|
||||
// if (!globalStore.token) return next({ path: LOGIN_URL, replace: true });
|
||||
if (!globalStore.token) return next({ path: "load", replace: true });
|
||||
|
||||
// 6.如果没有菜单列表,就重新请求菜单列表并添加动态路由
|
||||
const authStore = AuthStore();
|
||||
|
||||
@ -30,7 +30,8 @@ export const initDynamicRouter = async (params?: any) => {
|
||||
});
|
||||
globalStore.resetStore();
|
||||
|
||||
router.replace(LOGIN_URL);
|
||||
// router.replace(LOGIN_URL);
|
||||
router.replace("/load");
|
||||
return Promise.reject("No permission");
|
||||
}
|
||||
|
||||
@ -65,7 +66,8 @@ export const initDynamicRouter = async (params?: any) => {
|
||||
} catch (error) {
|
||||
// 💢 当按钮 || 菜单请求出错时,重定向到登陆页
|
||||
globalStore.resetStore();
|
||||
router.replace(LOGIN_URL);
|
||||
// router.replace(LOGIN_URL);
|
||||
router.replace("/load");
|
||||
return Promise.reject(error);
|
||||
}
|
||||
};
|
||||
|
||||
@ -53,7 +53,8 @@ const tokenIdentify = async () => {
|
||||
globalStore.moduleId = "1670603312504918018";
|
||||
}
|
||||
} else {
|
||||
ElMessage.error("登录错误!");
|
||||
// ElMessage.error("登录信息异常,请刷新或重新登录!");
|
||||
return;
|
||||
}
|
||||
console.log(res);
|
||||
};
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user