fix(axios): get等方法配置ignoreCancelToken无效 (#3040)

This commit is contained in:
leo 2023-09-18 10:04:24 +08:00 committed by GitHub
parent 4aaddef06f
commit b43fe7adbc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -88,8 +88,8 @@ export class VAxios {
// Request interceptor configuration processing // Request interceptor configuration processing
this.axiosInstance.interceptors.request.use((config: InternalAxiosRequestConfig) => { this.axiosInstance.interceptors.request.use((config: InternalAxiosRequestConfig) => {
// If cancel repeat request is turned on, then cancel repeat request is prohibited // If cancel repeat request is turned on, then cancel repeat request is prohibited
const { requestOptions } = this.options; const requestOptions = (config as unknown as any).requestOptions ?? this.options.requestOptions;
const ignoreCancelToken = requestOptions?.ignoreCancelToken ?? true; const ignoreCancelToken = requestOptions?.ignoreCancelToken ?? true;
!ignoreCancelToken && axiosCanceler.addPending(config); !ignoreCancelToken && axiosCanceler.addPending(config);
@ -202,6 +202,10 @@ export class VAxios {
if (config.cancelToken) { if (config.cancelToken) {
conf.cancelToken = config.cancelToken; conf.cancelToken = config.cancelToken;
} }
if (config.signal) {
conf.signal = config.signal;
}
const transform = this.getTransform(); const transform = this.getTransform();