summaryrefslogtreecommitdiffstats
path: root/src/store/fileUploadStore.js
diff options
context:
space:
mode:
authorMarco Ambrosini <marcoambrosini@pm.me>2020-07-28 18:08:40 +0200
committerDaniel Calviño Sánchez <danxuliu@gmail.com>2020-08-12 00:06:51 +0200
commit722fe35aab6d497303499e975350f731e6266dee (patch)
treefaa4a6cfd09ff0182c60e7440dd2198ada8d2b4e /src/store/fileUploadStore.js
parentd598653a37f1764b7035a22836ede94acba0cf88 (diff)
Store current upload id
Signed-off-by: Marco Ambrosini <marcoambrosini@pm.me>
Diffstat (limited to 'src/store/fileUploadStore.js')
-rw-r--r--src/store/fileUploadStore.js12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/store/fileUploadStore.js b/src/store/fileUploadStore.js
index b7c7d4984..2c765c83d 100644
--- a/src/store/fileUploadStore.js
+++ b/src/store/fileUploadStore.js
@@ -32,6 +32,7 @@ const state = {
attachmentFolder: loadState('talk', 'attachment_folder'),
uploads: {
},
+ currentUploadId: undefined,
}
const getters = {
@@ -64,6 +65,10 @@ const getters = {
return 0
}
},
+
+ currentUploadId: (state) => {
+ return state.currentUploadId
+ },
}
const mutations = {
@@ -131,6 +136,11 @@ const mutations = {
console.debug('uploadId: ' + uploadId + ' index: ' + index)
Vue.set(state.uploads[uploadId].files[index], 'temporaryMessage', temporaryMessage)
},
+
+ // Sets the id of the current upload operation
+ setCurrentUploadId(state, currentUploadId) {
+ state.currentUploadId = currentUploadId
+ },
}
const actions = {
@@ -147,6 +157,8 @@ const actions = {
// Add temporary messages
for (const index in state.uploads[uploadId].files) {
+ // Set last upload id
+ commit('setCurrentUploadId', { uploadId })
// Mark file as uploading to prevent a second function call to start a
// second upload for the same file
commit('markFileAsUploading', { uploadId, index })