chore(task): move cover image setter to store
This commit is contained in:
parent
fad72e091b
commit
ee3965eae9
2 changed files with 9 additions and 5 deletions
|
@ -257,10 +257,7 @@ function copyUrl(attachment: IAttachment) {
|
||||||
}
|
}
|
||||||
|
|
||||||
async function setCoverImage(attachment: IAttachment | null) {
|
async function setCoverImage(attachment: IAttachment | null) {
|
||||||
const task = await taskStore.update({
|
const task = await taskStore.setCoverImage(props.task, attachment)
|
||||||
...props.task,
|
|
||||||
coverImageAttachmentId: attachment ? attachment.id : 0,
|
|
||||||
})
|
|
||||||
emit('task-changed', task)
|
emit('task-changed', task)
|
||||||
success({message: t('task.attachment.successfullyChangedCoverImage')})
|
success({message: t('task.attachment.successfullyChangedCoverImage')})
|
||||||
}
|
}
|
||||||
|
|
|
@ -409,6 +409,13 @@ export const useTaskStore = defineStore('task', {
|
||||||
cancel()
|
cancel()
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
async setCoverImage(task: ITask, attachment: IAttachment | null) {
|
||||||
|
return this.update({
|
||||||
|
...task,
|
||||||
|
coverImageAttachmentId: attachment ? attachment.id : 0,
|
||||||
|
})
|
||||||
|
}
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue