Skip to content
Snippets Groups Projects
Commit baf16615 authored by Sonia Zorba's avatar Sonia Zorba
Browse files

Handled upload errors

parent 3d0c8655
No related branches found
No related tags found
No related merge requests found
Pipeline #2032 passed
......@@ -188,15 +188,23 @@ 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(() => {
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);
});
});
},
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment