2
0
mirror of https://github.com/tenrok/axios.git synced 2026-06-20 20:00:40 +03:00

Adding Canceler parameters config and request (#4711)

Co-authored-by: Jay <jasonsaayman@gmail.com>
This commit is contained in:
毛呆
2022-05-16 14:19:46 +08:00
committed by GitHub
parent 24f22b2b0b
commit e762cf77b3
2 changed files with 3 additions and 3 deletions
Vendored
+1 -1
View File
@@ -210,7 +210,7 @@ export interface Cancel {
} }
export interface Canceler { export interface Canceler {
(message?: string): void; (message?: string, config?: AxiosRequestConfig, request?: any): void;
} }
export interface CancelTokenStatic { export interface CancelTokenStatic {
+2 -2
View File
@@ -49,13 +49,13 @@ function CancelToken(executor) {
return promise; return promise;
}; };
executor(function cancel(message) { executor(function cancel(message, config, request) {
if (token.reason) { if (token.reason) {
// Cancellation has already been requested // Cancellation has already been requested
return; return;
} }
token.reason = new CanceledError(message); token.reason = new CanceledError(message, config, request);
resolvePromise(token.reason); resolvePromise(token.reason);
}); });
} }