Эх сурвалжийг харах

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

zhangchong 1 жил өмнө
parent
commit
633a54f9b8
2 өөрчлөгдсөн 1 нэмэгдсэн , 5 устгасан
  1. 0 4
      src/main.ts
  2. 1 1
      src/utils/request.ts

+ 0 - 4
src/main.ts

@@ -18,10 +18,6 @@ const app = createApp(App);
 // 自定义指令和svg组件
 directive(app);
 other.elSvg(app);
-// app.config.errorHandler = async (err: any, instance: any, info: any) => {
-//     // 错误日志
-//     if (appConfig.clientLog) console.log('globalError: ', err, instance, info);
-// }
 // 全局组件挂载
 app.component('Pagination', Pagination);
 app.component('Empty', Empty);

+ 1 - 1
src/utils/request.ts

@@ -166,7 +166,7 @@ function httpErrorStatusHandle(error: any) {
 	if (error.message.includes('timeout')) message = '网络请求超时!';
 	if (error.message.includes('Network')) message = window.navigator.onLine ? '服务端异常!' : '您断网了!';
 	if (error.message.includes('Invalid URL')) message = '您请求的地址有误!';
-	if (error.response.status !== 401) {
+	if (error.response?.status !== 401) {
 		ElMessage({
 			type: 'error',
 			message,