diff options
author | Adrián Oliva <adrian.oliva@cimat.mx> | 2023-05-21 19:09:15 -0600 |
---|---|---|
committer | Adrián Oliva <adrian.oliva@cimat.mx> | 2023-05-21 19:09:15 -0600 |
commit | c5b628f17da1bfa17251ecf82fcb146751954b72 (patch) | |
tree | 041f3665fc8b60734649364245edee72fb18de61 /src/ToDo-UI/ListToDo.jsx | |
parent | f3852c1f5bea14e72e200389759f123b880ccfec (diff) | |
download | ToDo-App-FE-c5b628f17da1bfa17251ecf82fcb146751954b72.tar.gz ToDo-App-FE-c5b628f17da1bfa17251ecf82fcb146751954b72.zip |
First attempt at filtering to do's.
We have a separate list from the original `todos_list`. It saves all currently
filtered to do's for the listing to be as easy as possible.
Diffstat (limited to 'src/ToDo-UI/ListToDo.jsx')
-rw-r--r-- | src/ToDo-UI/ListToDo.jsx | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/src/ToDo-UI/ListToDo.jsx b/src/ToDo-UI/ListToDo.jsx index eed6e02..f2f9a3e 100644 --- a/src/ToDo-UI/ListToDo.jsx +++ b/src/ToDo-UI/ListToDo.jsx @@ -6,6 +6,7 @@ import { edit_todo, set_sort_todo, sort_todo, + refresh_filtered_todos, select_todos, select_current_sorting, } from "../features/todo/reducer"; @@ -50,6 +51,7 @@ function list_of_todos(edit_button, delete_button) { }) ); dispatch(sort_todo()); + dispatch(refresh_filtered_todos()); } // Table contents @@ -85,14 +87,15 @@ function list_of_todos(edit_button, delete_button) { type="checkbox" checked={item.done} id={"list-todo-done-" + item.id} - onChange={(e) => + onChange={(e) => { dispatch( change_done({ id: item.id, done: e.target.checked, }) - ) - } + ), + dispatch(refresh_filtered_todos()); + }} ></input> </div> </th> @@ -170,6 +173,7 @@ export function ListToDos() { }) ); dispatch(sort_todo()); + dispatch(refresh_filtered_todos()); handle_exit_modal(); } @@ -200,7 +204,10 @@ export function ListToDos() { <button type="button" className="btn btn-outline-dark" - onClick={(e) => dispatch(remove_todo(item.id))} + onClick={(e) => { + dispatch(remove_todo(item.id)), + dispatch(refresh_filtered_todos()); + }} > Delete </button> |