diff --git a/frontend/src/components/Upload.vue b/frontend/src/components/Upload.vue
index 2880d3c..b486184 100644
--- a/frontend/src/components/Upload.vue
+++ b/frontend/src/components/Upload.vue
@@ -18,7 +18,9 @@ export default defineComponent({
return {
file: null as FileList | null,
titleSendButton: "Envoyer",
- classSendButton: ""
+ classSendButton: "",
+ requestSent: 0,
+ requestEnded: 0,
}
},
props: {
@@ -39,16 +41,15 @@ export default defineComponent({
this.classSendButton = "error"
return;
}
+ this.titleSendButton = "Envoi en cours (" + this.requestEnded + "/" + this.file.length + ")";
Array.from(this.file).forEach((file, id) => {
-
let formData = new FormData();
formData.append('file', file);
- api.createImage(formData);
+ this.requestSent++;
+ const resp = api.createImage(formData);
+ resp.then(() => { this.requestEnded++; })
});
- this.$emit('updateImageList');
this.resetFile();
- this.titleSendButton = "Envoyé"
- this.classSendButton = "sent"
},
handleFilesUpload(event: InputFileEvent) {
this.file = event.target.files;
@@ -89,6 +90,16 @@ export default defineComponent({
}
};
});
+ },
+ requestEnded() {
+ if (this.requestEnded === this.requestSent) {
+ this.titleSendButton = "Images envoyées"
+ this.classSendButton = "sent"
+ this.$emit('updateImageList');
+ this.requestSent = 0;
+ this.requestEnded = 0;
+ } else
+ this.titleSendButton = "Envoi en cours (" + this.requestEnded + "/" + this.requestSent + ")";
}
}
})
@@ -99,7 +110,7 @@ export default defineComponent({
-
+