Match-id-aac8a03a414d15fb66b0400caf02e06db581b4c3
This commit is contained in:
commit
5cd66e232e
|
@ -7,5 +7,5 @@
|
|||
"env": {
|
||||
"NODE_ENV": "development"
|
||||
},
|
||||
"ext": "js,json"
|
||||
"ext": "js,mjs,json"
|
||||
}
|
||||
|
|
|
@ -29,6 +29,16 @@ class InulaRequest implements IrInterface {
|
|||
response: new InterceptorManager(),
|
||||
};
|
||||
this.processRequest = processRequest;
|
||||
|
||||
// 支持动态传递请求方法保证 this 指向正确
|
||||
this.request = this.request.bind(this);
|
||||
this.get = this.get.bind(this);
|
||||
this.delete = this.delete.bind(this);
|
||||
this.head = this.head.bind(this);
|
||||
this.options = this.options.bind(this);
|
||||
this.post = this.post.bind(this);
|
||||
this.put = this.put.bind(this);
|
||||
this.patch = this.patch.bind(this);
|
||||
}
|
||||
|
||||
request<T = unknown>(requestParam: string | Record<string, any>, config?: IrRequestConfig): Promise<IrResponse<T>> {
|
||||
|
|
|
@ -21,10 +21,13 @@ export const fetchRequest = (config: IrRequestConfig): Promise<IrResponse> => {
|
|||
withCredentials = false,
|
||||
onUploadProgress = null,
|
||||
onDownloadProgress = null,
|
||||
signal,
|
||||
} = config;
|
||||
|
||||
let controller = new AbortController();
|
||||
let signal = controller.signal;
|
||||
if (!signal) {
|
||||
signal = controller.signal;
|
||||
}
|
||||
|
||||
// 处理请求取消
|
||||
if (cancelToken) {
|
||||
|
|
Loading…
Reference in New Issue