feat: update request
Add response handle function in the axios request interceptors Change-Id: I02ef90030ef6cf54677f9aa8760c590b2f25c633
This commit is contained in:
parent
25548b01b6
commit
1c78e6356a
@ -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'] || '';
|
||||||
|
Loading…
Reference in New Issue
Block a user