浏览代码

记录后台请求失败

Michael Wang 6 年之前
父节点
当前提交
e4f75c8e5f
共有 1 个文件被更改,包括 14 次插入0 次删除
  1. 14 0
      src/utils/axios.js

+ 14 - 0
src/utils/axios.js

@@ -67,6 +67,20 @@ qmInstance.interceptors.response.use(
     let status = error.response.status;
 
     if (status != 200) {
+      if (![401, 403].includes(status) && wk_token) {
+        setTimeout(() => {
+          qmInstance.post(
+            "/api/ecs_core/log/studentClient/" + "debug/S-009001",
+            error.config.url + " 请求失败",
+            {
+              headers: {
+                "Content-Type": "text/plain"
+              }
+            }
+          );
+        }, 3 * 1000);
+      }
+
       const data = error.response.data;
       if (data && data.desc) {
         Message.error({