Browse Source

Update fetch and uploader

pull/4695/head
Artur Arseniev 3 years ago
parent
commit
9893fc9a5e
  1. 2
      src/asset_manager/view/FileUploader.ts
  2. 3
      src/utils/fetch.ts
  3. 4
      src/utils/promise-polyfill.d.ts

2
src/asset_manager/view/FileUploader.ts

@ -392,7 +392,7 @@ export default class FileUploaderView extends View {
promises.push(promise);
}
Promise.all(promises).then(
return Promise.all(promises).then(
data => {
response.data = data;
// @ts-ignore

3
src/utils/fetch.ts

@ -1,4 +1,3 @@
// @ts-ignore
import Promise from 'promise-polyfill';
import { hasWin } from './mixins';
@ -10,7 +9,7 @@ export default typeof fetch == 'function'
? // @ts-ignore
fetch.bind()
: (url: string, options: Record<string, any>) => {
return new Promise((res: any, rej: any) => {
return new Promise((res, rej) => {
const req = new XMLHttpRequest();
req.open(options.method || 'get', url);
req.withCredentials = options.credentials == 'include';

4
src/utils/promise-polyfill.d.ts

@ -0,0 +1,4 @@
declare module 'promise-polyfill' {
const defType: PromiseConstructor;
export default defType;
}
Loading…
Cancel
Save