瀏覽代碼

fix: 优化errorHandler

lanjianrong 4 年之前
父節點
當前提交
e78a4c2a4a
共有 1 個文件被更改,包括 3 次插入2 次删除
  1. 3 2
      src/app.tsx

+ 3 - 2
src/app.tsx

@@ -131,13 +131,14 @@ const errorHandler = error => {
       default:
         break
     }
+    return Promise.reject(data)
   } else {
     notification.error({
       description: '您的网络发生异常,无法连接服务器',
       message: '网络异常'
     })
   }
-  return data
+  return Promise.reject(error)
 }
 
 const authHeaderInterceptor = (url, options) => {
@@ -163,7 +164,7 @@ export const request: RequestConfig = {
   cache: 'no-cache',
   errorConfig: {
     adaptor: resData => {
-      if (resData.code === consts.RET_CODE.SUCCESS) {
+      if (notificationLimit !== 0 && resData.code === consts.RET_CODE.SUCCESS) {
         notificationLimit = 0
       }
       return {