fix: skipErrorHandler 参数问题

This commit is contained in:
winixt 2023-12-14 19:32:15 +08:00
parent ac4fcb6526
commit fe5946daba
2 changed files with 5 additions and 2 deletions

View File

@ -1,6 +1,6 @@
{
"name": "@fesjs/plugin-request",
"version": "3.0.3",
"version": "3.0.4",
"description": "@fesjs/plugin-request",
"main": "lib/index.js",
"files": [

View File

@ -122,7 +122,10 @@ export const request = (url, data, options = {}) => {
return currentRequestInstance.request(context).then(async () => {
if (context.config.skipErrorHandler) {
console.warn('3.x 已移除 skipErrorHandler 参数,请改用 dataHandler 处理');
if (context.config.skipErrorHandler === true || context.response?.data?.code === context.config.skipErrorHandler) {
if (
((context.error || context.response?.data?.code !== '0') && context.config.skipErrorHandler === true) ||
context.response?.data?.code === context.config.skipErrorHandler
) {
return Promise.reject(context.response);
}
}