This commit is contained in:
parent
96660a7357
commit
dfde524f79
|
@ -306,18 +306,14 @@
|
|||
},
|
||||
editTask(id) {
|
||||
// Find the selected task and set it to the current object
|
||||
let theTask = this.list.getTaskByID(id) // Somhow this does not work if we directly assign this to this.taskEditTask
|
||||
//this.repeatAfter = theTask.getRepeatAfter()
|
||||
let theTask = this.list.getTaskByID(id) // Somehow this does not work if we directly assign this to this.taskEditTask
|
||||
this.taskEditTask = theTask
|
||||
this.isTaskEdit = true
|
||||
},
|
||||
editTaskSubmit() {
|
||||
this.taskService.update(this.taskEditTask)
|
||||
.then(r => {
|
||||
// Update the task in the list
|
||||
// FIXME:
|
||||
//this.updateTaskByID(this.taskEditTask.id, response.data)
|
||||
|
||||
this.list.updateTaskByID(r)
|
||||
this.$set(this, 'taskEditTask', r)
|
||||
this.handleSuccess({message: 'The task was successfully updated.'})
|
||||
})
|
||||
|
|
|
@ -83,7 +83,24 @@ export default class ListModel extends AbstractModel {
|
|||
return {} // FIXME: This should probably throw something to make it clear to the user noting was found
|
||||
}
|
||||
|
||||
updateTaskByID(task, id) {
|
||||
updateTaskByID(task) {
|
||||
for (const t in this.tasks) {
|
||||
if (this.tasks[t].id === task.id) {
|
||||
this.tasks[t] = task
|
||||
//this.$set(this.list.tasks, t, this.fixStuffComingFromAPI(updatedTask))
|
||||
break
|
||||
}
|
||||
|
||||
if (this.tasks[t].id === task.parentTaskID) {
|
||||
for (const s in this.tasks[t].subtasks) {
|
||||
if (this.tasks[t].subtasks[s].id === task.id) {
|
||||
this.tasks[t].subtasks[s] = task
|
||||
//this.$set(this.list.tasks[t].subtasks, s, updatedTask)
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
this.sortTasks()
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user