From 0fb5f6ba950e68c118cc455a5e8d48cb7140afd0 Mon Sep 17 00:00:00 2001 From: Artur Paikin Date: Sun, 18 Feb 2018 02:13:34 -0500 Subject: [PATCH] Followup fixes for #612 //cc @goto-bus-stop should we change all progress events to file instead of fileId too? #638 might be releavant too --- src/core/Core.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/core/Core.js b/src/core/Core.js index 8c5f16126..add62c1ba 100644 --- a/src/core/Core.js +++ b/src/core/Core.js @@ -614,11 +614,11 @@ class Uppy { this.setState({ error: error.message }) }) - this.on('upload-error', (fileID, error) => { - this.setFileState(fileID, { error: error.message }) + this.on('upload-error', (file, error) => { + this.setFileState(file.id, { error: error.message }) this.setState({ error: error.message }) - const fileName = this.getState().files[fileID].name + const fileName = file.name let message = `Failed to upload ${fileName}` if (typeof error === 'object' && error.message) { message = { message: message, details: error.message } @@ -659,9 +659,9 @@ class Uppy { this.on('upload-progress', _throttledCalculateProgress) - this.on('upload-success', (fileID, uploadResp, uploadURL) => { - this.setFileState(fileID, { - progress: Object.assign({}, this.getState().files[fileID].progress, { + this.on('upload-success', (file, uploadResp, uploadURL) => { + this.setFileState(file.id, { + progress: Object.assign({}, this.state.files[file.id].progress, { uploadComplete: true, percentage: 100 }),