Commit 3edb5da8 authored by yyh's avatar yyh

?操作符

parent 34a03c69
...@@ -118,10 +118,10 @@ instance.interceptors.response.use( ...@@ -118,10 +118,10 @@ instance.interceptors.response.use(
const diff = 200 - (Date.now() - time); const diff = 200 - (Date.now() - time);
if (diff) { if (diff) {
setTimeout(() => { setTimeout(() => {
loading && loading.clear(); loading?.clear();
}, diff); }, diff);
} else { } else {
loading && loading.clear(); loading?.clear();
} }
if ( res.status === 200) { if ( res.status === 200) {
if (res.data.code === 200) { if (res.data.code === 200) {
...@@ -139,6 +139,7 @@ instance.interceptors.response.use( ...@@ -139,6 +139,7 @@ instance.interceptors.response.use(
// 请求失败 // 请求失败
(error: any) => { (error: any) => {
const { response } = error; const { response } = error;
loading?.clear();
if (response) { if (response) {
// 请求已发出,但是不在2xx的范围 // 请求已发出,但是不在2xx的范围
errorHandle(response.status, response.data.message); errorHandle(response.status, response.data.message);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment