fix draft editing

This commit is contained in:
Henry Jameson 2026-09-02 19:01:56 +03:00
commit 266e711786
4 changed files with 11 additions and 12 deletions

View file

@ -62,14 +62,13 @@ export const useDraftsStore = defineStore('drafts', {
},
async addOrSaveDraft(draft) {
const id = draft.id ?? new Date().getTime().toString()
console.log('SAVE', id)
const draftWithId = { ...draft, id }
this.drafts.set(draft.id, draftWithId)
this.drafts.set(id, draftWithId)
await saveDraftToStorage(draftWithId)
return id
},
async abandonAllDrafts(store) {
const ids = this.drafts.keys()
const ids = [...this.drafts.keys()]
ids.forEach((id) => this.abandonDraft(id))
await deleteDraftFromStorage(ids)
},