Browse Source

reactor:登录过期弹窗只弹出一次(避免多次弹窗异常);

zhangchong 1 year ago
parent
commit
fb7a60be2c
1 changed files with 2 additions and 1 deletions
  1. 2 1
      src/utils/request.ts

+ 2 - 1
src/utils/request.ts

@@ -88,9 +88,9 @@ export default function myAxios(axiosConfig: any, customOptions?: customOptionsT
  * @description 处理异常
  * @param {*} error
  */
+let tokenAbnormal: boolean = false;
 function httpErrorStatusHandle(error: any) {
 	// 设置一个变量 处理同一时间多个错误重复弹窗口
-	let tokenAbnormal: boolean = false;
 	// 处理被取消的请求
 	if (axios.isCancel(error)) return;
 	let message = '';
@@ -103,6 +103,7 @@ function httpErrorStatusHandle(error: any) {
 				message = '参数不正确!';
 				break;
 			case 401:
+				message = '登录过期,请重新登录';
 				if (!tokenAbnormal) {
 					tokenAbnormal = true;
 					// 弹出框