feat: update request

Add response handle function in the axios request interceptors

Change-Id: I02ef90030ef6cf54677f9aa8760c590b2f25c633
This commit is contained in:
Jingwei.Zhang 2023-05-31 18:01:37 +08:00
parent 25548b01b6
commit 1c78e6356a

View File

@ -92,6 +92,10 @@ export class HttpRequest {
return config; return config;
} }
handleResponse(response) {
return response;
}
/** /**
* @param instance instance of axios * @param instance instance of axios
* @param url request url * @param url request url
@ -109,6 +113,7 @@ export class HttpRequest {
instance.interceptors.response.use( instance.interceptors.response.use(
(response) => { (response) => {
// request is finished // request is finished
this.handleResponse(response);
const { data, status } = response; const { data, status } = response;
const disposition = response.headers['content-disposition'] || ''; const disposition = response.headers['content-disposition'] || '';
const contentType = response.headers['content-type'] || ''; const contentType = response.headers['content-type'] || '';