mirror of
https://github.com/tenrok/axios.git
synced 2026-05-15 11:59:42 +03:00
opt: opt judgment code of cancel (#4587)
Co-authored-by: Jay <jasonsaayman@gmail.com>
This commit is contained in:
@@ -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);
|
||||
|
||||
+1
-1
@@ -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;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user