diff --git a/src/renderers/Form/InputFile.tsx b/src/renderers/Form/InputFile.tsx index 4bf87f18e..65fffc979 100644 --- a/src/renderers/Form/InputFile.tsx +++ b/src/renderers/Form/InputFile.tsx @@ -1045,16 +1045,7 @@ export default class FileControl extends React.Component { while (tasks.length) { const res = await Promise.all( tasks.splice(0, concurrency).map(async task => { - return await uploadPartFile(state, config)( - task, - (err: any, value: any) => { - if (err) { - reject(err); - throw new Error(err); - } - return value; - } - ); + return await uploadPartFile(state, config)(task); }) ); results = results.concat(res); @@ -1104,7 +1095,7 @@ export default class FileControl extends React.Component { } function uploadPartFile(state: ObjectState, conf: Partial) { - return (task: Task, callback: (error: any, value?: any) => void) => { + return (task: Task) => { const api = buildApi( conf.chunkApi!, createObject(config.data, params), @@ -1137,12 +1128,11 @@ export default class FileControl extends React.Component { ) .then(ret => { state.loaded++; - callback(null, { + return { partNumber: task.partNumber, eTag: (ret.data as any).eTag - }); - }) - .catch(callback); + }; + }); }; }