瀏覽代碼

解决超时报错问题

zhangjie 3 年之前
父節點
當前提交
712172f665
共有 1 個文件被更改,包括 3 次插入1 次删除
  1. 3 1
      src/plugins/axios.js

+ 3 - 1
src/plugins/axios.js

@@ -90,7 +90,9 @@ axios.interceptors.response.use(
     return response;
   },
   error => {
-    initSyncTime(new Date(error.response.headers.date).getTime());
+    if (error.response) {
+      initSyncTime(new Date(error.response.headers.date).getTime());
+    }
     // 关闭loading提示
     setTimeout(() => {
       queue.shift();