fix: http响应拦截处避免error报错的问题

This commit is contained in:
刘洪洪
2023-09-12 14:27:26 +08:00
parent 285c5d546d
commit 49892c3fb8

View File

@@ -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 = '/'
}