From 49892c3fb8a7f4b79624df12407abe39a1c805b0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=88=98=E6=B4=AA=E6=B4=AA?= <2498601771@qq.com> Date: Tue, 12 Sep 2023 14:27:26 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20http=E5=93=8D=E5=BA=94=E6=8B=A6=E6=88=AA?= =?UTF-8?q?=E5=A4=84=E9=81=BF=E5=85=8Derror=E6=8A=A5=E9=94=99=E7=9A=84?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/utils/http.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/utils/http.js b/src/utils/http.js index ea268148..eca9d4ef 100644 --- a/src/utils/http.js +++ b/src/utils/http.js @@ -70,10 +70,10 @@ axios.interceptors.response.use( }, error => { try { - if (licenceErrorCode.indexOf(error.response.data.code) !== -1) { + if (error.response && licenceErrorCode.indexOf(error.response.data.code) !== -1) { localStorage.removeItem(storageKey.token) window.location.href = '/' - } else if (accountErrorCode.indexOf(error.response.data.code) !== -1) { + } else if (error.response && accountErrorCode.indexOf(error.response.data.code) !== -1) { localStorage.removeItem(storageKey.token) window.location.href = '/' }