浏览代码

报错提示信息

chenrui 4 年之前
父节点
当前提交
bf20ee99e1
共有 1 个文件被更改,包括 8 次插入1 次删除
  1. 8 1
      src/utils/request.js

+ 8 - 1
src/utils/request.js

@@ -52,7 +52,7 @@ service.interceptors.request.use(config => {
 
 // response interceptor
 service.interceptors.response.use((response) => {
-  // console.log(response, 'responseresponseresponse')
+  console.log(response, 'responseresponseresponse')
   if (response.data.status == '-1') {
     notification.error({
       message: '提示',
@@ -64,6 +64,13 @@ service.interceptors.response.use((response) => {
       })
     }, 2000)
   }
+  if ((response.data.status == '900' || response.data.status == '500') && window.location.pathname != '/user/login') {
+    notification.destroy()
+    notification.error({
+      message: '提示',
+      description: response.data.message
+    })
+  }
   return response.data
 }, err)