Skip to content

Commit

Permalink
opt: opt judgment code of cancel (#4587)
Browse files Browse the repository at this point in the history
Co-authored-by: Jay <jasonsaayman@gmail.com>
  • Loading branch information
zh-lx and jasonsaayman committed May 3, 2022
1 parent e9efc69 commit e52af17
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/adapters/http.js
Expand Up @@ -402,7 +402,7 @@ module.exports = function httpAdapter(config) {
if (req.aborted) return;

req.abort();
reject(!cancel || (cancel && cancel.type) ? new CanceledError() : cancel);
reject(!cancel || cancel.type ? new CanceledError() : cancel);
};

config.cancelToken && config.cancelToken.subscribe(onCanceled);
Expand Down
2 changes: 1 addition & 1 deletion lib/adapters/xhr.js
Expand Up @@ -193,7 +193,7 @@ module.exports = function xhrAdapter(config) {
if (!request) {
return;
}
reject(!cancel || (cancel && cancel.type) ? new CanceledError() : cancel);
reject(!cancel || cancel.type ? new CanceledError() : cancel);
request.abort();
request = null;
};
Expand Down

0 comments on commit e52af17

Please sign in to comment.