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:
Vendored
+1
-1
@@ -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 {
|
||||||
|
|||||||
@@ -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);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user