|
@@ -228,8 +228,14 @@ function fetch(...args:any):Promise {
|
228
|
228
|
return fetchFile(options, method, url, headers, body)
|
229
|
229
|
}
|
230
|
230
|
|
|
231
|
+ let promiseResolve;
|
|
232
|
+ let promiseReject;
|
|
233
|
+
|
231
|
234
|
|
232
|
235
|
let promise = new Promise((resolve, reject) => {
|
|
236
|
+ promiseResolve = resolve;
|
|
237
|
+ promiseReject = reject;
|
|
238
|
+
|
233
|
239
|
let nativeMethodName = Array.isArray(body) ? 'fetchBlobForm' : 'fetchBlob'
|
234
|
240
|
|
235
|
241
|
|
|
@@ -370,6 +376,7 @@ function fetch(...args:any):Promise {
|
370
|
376
|
subscriptionUpload.remove()
|
371
|
377
|
stateEvent.remove()
|
372
|
378
|
RNFetchBlob.cancelRequest(taskId, fn)
|
|
379
|
+ promiseReject(new Error("canceled"))
|
373
|
380
|
}
|
374
|
381
|
promise.taskId = taskId
|
375
|
382
|
|