chore(task): move cover image setter to store

This commit is contained in:
kolaente 2022-10-03 15:23:34 +02:00
parent fad72e091b
commit ee3965eae9
Signed by: konrad
GPG Key ID: F40E70337AB24C9B
2 changed files with 9 additions and 5 deletions

View File

@ -257,10 +257,7 @@ function copyUrl(attachment: IAttachment) {
}
async function setCoverImage(attachment: IAttachment | null) {
const task = await taskStore.update({
...props.task,
coverImageAttachmentId: attachment ? attachment.id : 0,
})
const task = await taskStore.setCoverImage(props.task, attachment)
emit('task-changed', task)
success({message: t('task.attachment.successfullyChangedCoverImage')})
}

View File

@ -409,6 +409,13 @@ export const useTaskStore = defineStore('task', {
cancel()
}
},
async setCoverImage(task: ITask, attachment: IAttachment | null) {
return this.update({
...task,
coverImageAttachmentId: attachment ? attachment.id : 0,
})
}
},
})