refactor: 优化session掉线后页面上显示的报错信息
--bug=1012741 --user=刘瑞斌 【登录】认证信息过期会报错 https://www.tapd.cn/55049933/s/1168841
This commit is contained in:
parent
34ee6760f3
commit
2823efd2b0
|
@ -31,8 +31,15 @@ export function getUploadConfig(url, formData) {
|
||||||
|
|
||||||
// 登入请求不重定向
|
// 登入请求不重定向
|
||||||
let unRedirectUrls = new Set(['signin', 'ldap/signin', '/signin', '/ldap/signin']);
|
let unRedirectUrls = new Set(['signin', 'ldap/signin', '/signin', '/ldap/signin']);
|
||||||
|
// session 是否掉线
|
||||||
|
let isSessionTimeout = false;
|
||||||
|
|
||||||
export function login() {
|
export function login() {
|
||||||
|
if (isSessionTimeout) {
|
||||||
|
// 已经弹出session掉线框
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
isSessionTimeout = true;
|
||||||
MessageBox.alert(i18n.t('commons.tips'), i18n.t('commons.prompt'), {
|
MessageBox.alert(i18n.t('commons.tips'), i18n.t('commons.prompt'), {
|
||||||
callback: () => {
|
callback: () => {
|
||||||
axios.get("/signout");
|
axios.get("/signout");
|
||||||
|
@ -43,6 +50,11 @@ export function login() {
|
||||||
}
|
}
|
||||||
|
|
||||||
function then(success, response, result) {
|
function then(success, response, result) {
|
||||||
|
// 已经掉线不再弹出错误信息,避免满屏都是错误
|
||||||
|
if (response && response.headers["authentication-status"] === "invalid") {
|
||||||
|
login();
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (!response.data) {
|
if (!response.data) {
|
||||||
success(response);
|
success(response);
|
||||||
} else if (response.data.success !== false) {
|
} else if (response.data.success !== false) {
|
||||||
|
|
Loading…
Reference in New Issue