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