chore(task): move toggleFavorite to store
Some checks failed
continuous-integration/drone/pr Build is failing
Some checks failed
continuous-integration/drone/pr Build is failing
This commit is contained in:
parent
ebb239f683
commit
a0d45dcd89
|
@ -258,9 +258,7 @@ function undoDone(checked: boolean) {
|
||||||
}
|
}
|
||||||
|
|
||||||
async function toggleFavorite() {
|
async function toggleFavorite() {
|
||||||
task.value.isFavorite = !task.value.isFavorite
|
task.value = taskStore.toggleFavorite(task.value)
|
||||||
task.value = await taskService.update(task.value)
|
|
||||||
await projectStore.loadProjects() // reloading the projects list so that the Favorites project shows up or is hidden when there are (or are not) favorite tasks
|
|
||||||
emit('task-updated', task.value)
|
emit('task-updated', task.value)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -432,6 +432,17 @@ export const useTaskStore = defineStore('task', () => {
|
||||||
coverImageAttachmentId: attachment ? attachment.id : 0,
|
coverImageAttachmentId: attachment ? attachment.id : 0,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async function toggleFavorite(task: ITask) {
|
||||||
|
const taskService = new TaskService()
|
||||||
|
task.isFavorite = !task.isFavorite
|
||||||
|
task = await taskService.update(task)
|
||||||
|
|
||||||
|
// reloading the projects list so that the Favorites project shows up or is hidden when there are (or are not) favorite tasks
|
||||||
|
await projectStore.loadProjects()
|
||||||
|
|
||||||
|
return task
|
||||||
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
tasks,
|
tasks,
|
||||||
|
|
|
@ -753,8 +753,7 @@ async function changeProject(project: IProject) {
|
||||||
}
|
}
|
||||||
|
|
||||||
async function toggleFavorite() {
|
async function toggleFavorite() {
|
||||||
task.isFavorite = !task.isFavorite
|
const newTask = taskStore.toggleFavorite(task.value)
|
||||||
const newTask = await taskService.update(task)
|
|
||||||
Object.assign(task, newTask)
|
Object.assign(task, newTask)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Reference in New Issue
Block a user