Skip to content

Commit

Permalink
Update request.js
Browse files Browse the repository at this point in the history
  • Loading branch information
rainbowflesh authored Mar 5, 2024
1 parent 84613dc commit da8afc1
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/utils/request.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 &&
Expand Down

0 comments on commit da8afc1

Please sign in to comment.