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

@ -6,6 +6,9 @@ export const defaultState = {
export const mutations = {
addOrSaveDraft (state, { draft }) {
state.drafts[draft.id] = draft
},
abandonDraft (state, { id }) {
delete state.drafts[id]
}
}
@ -14,6 +17,9 @@ export const actions = {
const id = draft.id || (new Date().getTime()).toString()
store.commit('addOrSaveDraft', { draft: { ...draft, id } })
return id
},
abandonDraft (store, { id }) {
store.commit('abandonDraft', { id })
}
}