add option to remove all drafts in one go

This commit is contained in:
Henry Jameson 2026-05-05 20:16:16 +03:00
commit 5cb0204305
3 changed files with 76 additions and 21 deletions

View file

@ -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