Skip to content

Commit

Permalink
fix(axios): get等方法配置ignoreCancelToken无效 (#3040)
Browse files Browse the repository at this point in the history
  • Loading branch information
slshsl authored Sep 18, 2023
1 parent 4aaddef commit b43fe7a
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/utils/http/axios/Axios.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,8 @@ export class VAxios {

// Request interceptor configuration processing
this.axiosInstance.interceptors.request.use((config: InternalAxiosRequestConfig) => {
// If cancel repeat request is turned on, then cancel repeat request is prohibited
const { requestOptions } = this.options;
// If cancel repeat request is turned on, then cancel repeat request is prohibited
const requestOptions = (config as unknown as any).requestOptions ?? this.options.requestOptions;
const ignoreCancelToken = requestOptions?.ignoreCancelToken ?? true;

!ignoreCancelToken && axiosCanceler.addPending(config);
Expand Down Expand Up @@ -202,6 +202,10 @@ export class VAxios {
if (config.cancelToken) {
conf.cancelToken = config.cancelToken;
}

if (config.signal) {
conf.signal = config.signal;
}

const transform = this.getTransform();

Expand Down

0 comments on commit b43fe7a

Please sign in to comment.