add option to remove all drafts in one go
This commit is contained in:
parent
17b82be1a4
commit
5cb0204305
3 changed files with 76 additions and 21 deletions
|
|
@ -1,16 +1,39 @@
|
|||
import Draft from 'src/components/draft/draft.vue'
|
||||
import List from 'src/components/list/list.vue'
|
||||
import ConfirmModal from 'src/components/confirm_modal/confirm_modal.vue'
|
||||
|
||||
const Drafts = {
|
||||
components: {
|
||||
Draft,
|
||||
List,
|
||||
ConfirmModal,
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
showingConfirmDialog: false
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
drafts() {
|
||||
return this.$store.getters.draftsArray
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
abandonAll() {
|
||||
this.showingConfirmDialog = true
|
||||
},
|
||||
doAbandonAll() {
|
||||
this.drafts.forEach((draft) => {
|
||||
this.$store.dispatch('abandonDraft', { id: draft.id }).then(() => {
|
||||
this.hideConfirmDialog()
|
||||
})
|
||||
})
|
||||
this.hideConfirmDialog()
|
||||
},
|
||||
hideConfirmDialog() {
|
||||
this.showingConfirmDialog = false
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
export default Drafts
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue