Преглед на файлове

系统异常,显示code报错码

chenrui преди 3 години
родител
ревизия
3746ac8d14
променени са 1 файла, в които са добавени 8 реда и са изтрити 3 реда
  1. 8 3
      src/utils/request.js

+ 8 - 3
src/utils/request.js

@@ -38,10 +38,8 @@ const err = (error) => {
 // request interceptor
 service.interceptors.request.use(config => {
   const token = store.getters.token
-  const changeOrg = store.getters.changeOrg
   if (token) {
     config.headers['access-token'] = token // 让每个请求携带自定义 token 请根据实际情况自行修改
-    config.headers['access-org'] = changeOrg // 当前要切换的账号 sn
   }
   return config
 }, err)
@@ -64,13 +62,20 @@ service.interceptors.response.use((response) => {
       }
     })
   }
-  if ((response.data.status == '401' || response.data.status == '900' || response.data.status == '500') && window.location.pathname != '/user/login') {
+  if ((response.data.status == '401' || response.data.status == '500') && window.location.pathname != '/user/login') {
     notification.destroy()
     notification.error({
       message: '提示',
       description: response.data.message
     })
   }
+  if (response.data.status == '900' && window.location.pathname != '/user/login') {
+    notification.destroy()
+    notification.error({
+      message: response.data.message,
+      description: response.data.code
+    })
+  }
   return response.data
 }, err)