Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add store action to discard an upload
Signed-off-by: Daniel Calviño Sánchez <[email protected]>
  • Loading branch information
danxuliu authored and PVince81 committed Feb 9, 2021
commit 911e5e802c61489bf010b8a10b87f0db1ebac4b1
1 change: 1 addition & 0 deletions src/components/UploadEditor.vue
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ export default {

methods: {
handleDismiss() {
this.$store.dispatch('discardUpload', this.currentUploadId)
this.modalDismissed = true
},

Expand Down
13 changes: 13 additions & 0 deletions src/store/fileUploadStore.js
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,10 @@ const mutations = {
}
}
},

discardUpload(state, uploadId) {
Vue.delete(state.uploads, uploadId)
},
}

const actions = {
Expand All @@ -204,6 +208,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
Expand Down