diff options
author | Daniel Calviño Sánchez <danxuliu@gmail.com> | 2020-11-06 21:28:28 +0300 |
---|---|---|
committer | Vincent Petry <vincent@nextcloud.com> | 2021-02-09 11:35:52 +0300 |
commit | f8dd0a2ae3ae7c5439eb21ae616880a32e0ba502 (patch) | |
tree | 12c5e839db2f6426ccf4bd42aaaaa7ae18c19b39 | |
parent | 2332050e1d50f965bfd666583e790af87e2847c7 (diff) |
Add store action to discard an upload
Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
-rw-r--r-- | src/components/UploadEditor.vue | 1 | ||||
-rw-r--r-- | src/store/fileUploadStore.js | 13 |
2 files changed, 14 insertions, 0 deletions
diff --git a/src/components/UploadEditor.vue b/src/components/UploadEditor.vue index 00ca6a0d9..2258ac787 100644 --- a/src/components/UploadEditor.vue +++ b/src/components/UploadEditor.vue @@ -135,6 +135,7 @@ export default { }, handleDismiss() { + this.$store.dispatch('discardUpload', this.currentUploadId) this.modalDismissed = true }, diff --git a/src/store/fileUploadStore.js b/src/store/fileUploadStore.js index 85acf4ef6..f094d9d2b 100644 --- a/src/store/fileUploadStore.js +++ b/src/store/fileUploadStore.js @@ -187,6 +187,10 @@ const mutations = { } } }, + + discardUpload(state, uploadId) { + Vue.delete(state.uploads, uploadId) + }, } const actions = { @@ -211,6 +215,15 @@ const actions = { }, /** + * Discards an upload + * @param {object} param0 Commit and state + * @param {object} uploadId The unique uploadId + */ + discardUpload({ commit, state, getters }, uploadId) { + commit('discardUpload', { uploadId }) + }, + + /** * Uploads the files to the root directory of the user * @param {object} param0 Commit, state and getters * @param {object} uploadId The unique uploadId |