Update request.js

This commit is contained in:
是虹川肉 2024-03-05 19:00:27 +08:00 committed by GitHub
parent 84613dcf8a
commit da8afc12cf
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 10 additions and 2 deletions

View File

@ -57,8 +57,16 @@ service.interceptors.response.use(
},
async error => {
/** @type {import('axios').AxiosResponse | null} */
const response = error.response;
const data = response.data;
let response;
let data;
if (error === 'TypeError: baseURL is undefined') {
response = error;
data = error;
console.error("You must set up the baseURL in the service's config");
} else if (error.response) {
response = error.response;
data = response.data;
}
if (
response &&