Make it possible to abandon draft
This commit is contained in:
parent
02e2e6b1bf
commit
a245379f43
4 changed files with 77 additions and 13 deletions
|
|
@ -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 })
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue