Skip to content

Commit 6809472

Browse files
committed
Update: delete todos completed
1 parent edcb910 commit 6809472

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

04-ToDo-app/src/store/todo.store.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ const setFilter = ( newFilter = Filters.All ) => {
100100
}
101101

102102
const getCurrentFilter = () => {
103-
return state.filter;
103+
return state.filter;
104104
}
105105

106106

04-ToDo-app/src/todos/app.js

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@ import { renderTodos } from './use-cases';
44
const ElementIDs={
55
TodoList:'.todo-list',
66
NewTodoInput:'#new-todo-input',
7-
DeleteElement:".destroy"
7+
DeleteElement:".destroy",
8+
ClearCompletedButton:".clear-completed",
89
}
910

1011
/**
@@ -35,7 +36,7 @@ export const App = ( elementId ) => {
3536
const newDescriptionInput=document.querySelector(ElementIDs.NewTodoInput)
3637
const todoListUL=document.querySelector(ElementIDs.TodoList)
3738
const destroylistUl=document.querySelector(ElementIDs.DeleteElement)
38-
39+
const clearCompletedButton=document.querySelector(ElementIDs.ClearCompletedButton)
3940

4041

4142
//listeners
@@ -65,6 +66,12 @@ export const App = ( elementId ) => {
6566
});
6667

6768

69+
clearCompletedButton.addEventListener('click', () => {
70+
todoStore.deleteCompleted();
71+
displayTodos();
72+
});
73+
74+
6875
}
6976

7077

0 commit comments

Comments
 (0)