mirror of
https://github.com/tenrok/axios.git
synced 2026-06-23 20:40: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 {
|
||||
(message?: string): void;
|
||||
(message?: string, config?: AxiosRequestConfig, request?: any): void;
|
||||
}
|
||||
|
||||
export interface CancelTokenStatic {
|
||||
|
||||
@@ -49,13 +49,13 @@ function CancelToken(executor) {
|
||||
return promise;
|
||||
};
|
||||
|
||||
executor(function cancel(message) {
|
||||
executor(function cancel(message, config, request) {
|
||||
if (token.reason) {
|
||||
// Cancellation has already been requested
|
||||
return;
|
||||
}
|
||||
|
||||
token.reason = new CanceledError(message);
|
||||
token.reason = new CanceledError(message, config, request);
|
||||
resolvePromise(token.reason);
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user