diff --git a/vospace-ui-frontend/src/store.js b/vospace-ui-frontend/src/store.js index ffa860486dd4c30693bf84501407184ac0b43ce7..051e2a5816c27f44dfd2b65e4a300f1b8e0a13c7 100644 --- a/vospace-ui-frontend/src/store.js +++ b/vospace-ui-frontend/src/store.js @@ -188,16 +188,24 @@ export default new Vuex.Store({ for (let file of files) { names.push(file.name); } - client.prepareForUpload(state.path, names) + return client.prepareForUpload(state.path, names) .then(uploadUrls => { let uploads = []; for (let i = 0; i < files.length; i++) { uploads.push(client.uploadFile(uploadUrls[i], files[i])); } - Promise.all(uploads).then(() => { - // Reload current node when all uploads completed - dispatch('setPath', state.path); - }); + Promise.all(uploads) + .then(() => { + // Reload current node when all uploads completed + dispatch('setPath', state.path); + }) + .catch(error => { + let message = "Unable to upload file" + if (error.response && error.response.data) { + message += ": " + error.response.data; + } + main.showError(message); + }); }); }, deleteNodes({ state, dispatch }) {