处理message提示
Some checks are pending
Check / lint (push) Waiting to run
Check / typecheck (push) Waiting to run
Check / build (build, 18.x, ubuntu-latest) (push) Waiting to run
Check / build (build, 18.x, windows-latest) (push) Waiting to run
Check / build (build:app, 18.x, ubuntu-latest) (push) Waiting to run
Check / build (build:app, 18.x, windows-latest) (push) Waiting to run
Check / build (build:mp-weixin, 18.x, ubuntu-latest) (push) Waiting to run
Check / build (build:mp-weixin, 18.x, windows-latest) (push) Waiting to run
Some checks are pending
Check / lint (push) Waiting to run
Check / typecheck (push) Waiting to run
Check / build (build, 18.x, ubuntu-latest) (push) Waiting to run
Check / build (build, 18.x, windows-latest) (push) Waiting to run
Check / build (build:app, 18.x, ubuntu-latest) (push) Waiting to run
Check / build (build:app, 18.x, windows-latest) (push) Waiting to run
Check / build (build:mp-weixin, 18.x, ubuntu-latest) (push) Waiting to run
Check / build (build:mp-weixin, 18.x, windows-latest) (push) Waiting to run
This commit is contained in:
parent
ed2d6dfbd5
commit
47d5cab23a
@ -40,7 +40,8 @@ const request = new Request({
|
|||||||
},
|
},
|
||||||
responseInterceptors: async (res) => {
|
responseInterceptors: async (res) => {
|
||||||
if(res.data.status===1){
|
if(res.data.status===1){
|
||||||
message.warning(res.data.msg)
|
// message.warning(res.data.msg)
|
||||||
|
messageInstance.warning(res.data.msg)
|
||||||
}
|
}
|
||||||
if (res.data.status === 401) {
|
if (res.data.status === 401) {
|
||||||
return getRefreshToken(res);
|
return getRefreshToken(res);
|
||||||
@ -49,11 +50,14 @@ const request = new Request({
|
|||||||
// })
|
// })
|
||||||
}
|
}
|
||||||
if ([200, 201, 204].includes(res.status)) {
|
if ([200, 201, 204].includes(res.status)) {
|
||||||
|
if(res.data.code !== 200 && res.data.code!== 0) {
|
||||||
|
messageInstance.error(res.data.message || 'An error occurred.');
|
||||||
|
}
|
||||||
return res.config.responseType === 'blob' ? res : res;
|
return res.config.responseType === 'blob' ? res : res;
|
||||||
} else {
|
} else {
|
||||||
/* message.error(res.data.msg || 'An error occurred.');*/
|
/* message.error(res.data.msg || 'An error occurred.');*/
|
||||||
messageInstance.error(res.data.msg || 'An error occurred.');
|
messageInstance.error(res.data.message || 'An error occurred.');
|
||||||
return Promise.reject(new Error(res.data.msg || 'An error occurred.'));
|
return Promise.reject(new Error(res.data.message || 'An error occurred.'));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -76,6 +80,7 @@ async function getRefreshToken(response) {
|
|||||||
})
|
})
|
||||||
return request.request(response.config);
|
return request.request(response.config);
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
messageInstance.error(res.message || res.msg);
|
messageInstance.error(res.message || res.msg);
|
||||||
throw new Error(res.message || res.msg);
|
throw new Error(res.message || res.msg);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user