// 响应拦截器
// response interceptor
service.interceptors.response.use(
/**
* If you want to get http information such as headers or status
* Please return response => response
*/
/**
* Determine the request status by custom code
* Here is just an example
* You can also judge the status by HTTP Status Code
*/
response => {
// console.log(response)
// 关闭loading
tryHideFullScreenLoading();
if (response.config.url.indexOf("/api/room/export/room") != -1) {
return response
}
if (response.data) {
const res = response.data
// if the custom code is not 20000, it is judged as an error.
if (res.code !== 200) {
Message.error({
content: res.msg,
duration: 3
})
return Promise.reject(res)
} else {
return res;
}
}
},
error => {
console.log(error) // for debug
return Promise.reject(error)
}
)