Make it possible to abandon draft

This commit is contained in:
tusooa 2023-03-10 12:39:08 -05:00
commit a245379f43
No known key found for this signature in database
GPG key ID: 42AEC43D48433C51
4 changed files with 77 additions and 13 deletions

View file

@ -1,8 +1,10 @@
import PostStatusForm from 'src/components/post_status_form/post_status_form.vue'
import ConfirmModal from 'src/components/confirm_modal/confirm_modal.vue'
const Draft = {
components: {
PostStatusForm
PostStatusForm,
ConfirmModal
},
props: {
draft: {
@ -12,7 +14,8 @@ const Draft = {
},
data () {
return {
editing: false
editing: false,
showingConfirmDialog: false
}
},
computed: {
@ -35,6 +38,23 @@ const Draft = {
methods: {
toggleEditing () {
this.editing = !this.editing
},
abandon () {
this.showingConfirmDialog = true
},
doAbandon () {
console.debug('abandoning')
this.$store.dispatch('abandonDraft', { id: this.draft.id })
.then(() => {
this.hideConfirmDialog()
})
},
hideConfirmDialog () {
this.showingConfirmDialog = false
},
handlePosted () {
console.debug('posted')
this.doAbandon()
}
}
}