[FIX] playground: todo app clear complete tasks

Just fix a little bug when clicked on "Clear Completed"
Also removed unusefull method.
This commit is contained in:
Pierre Pulinckx (pipu)
2023-07-25 14:14:23 +02:00
committed by Sam Degueldre
parent 9d99f8936b
commit 9b1c270501
+1 -5
View File
@@ -43,10 +43,6 @@ class TaskList {
}
}
toggleTask(task) {
task.isCompleted = !task.isCompleted;
}
toggleTask(id) {
const task = this.tasks.find(t => t.id === id);
task.isCompleted = !task.isCompleted;
@@ -61,7 +57,7 @@ class TaskList {
clearCompleted() {
const tasks = this.tasks.filter(t => t.isCompleted);
for (let task of tasks) {
this.deleteTask(task);
this.deleteTask(task.id);
}
}