diff options
author | Adrián Oliva <adrian.oliva@cimat.mx> | 2023-05-29 12:42:46 -0600 |
---|---|---|
committer | Adrián Oliva <adrian.oliva@cimat.mx> | 2023-05-29 12:42:46 -0600 |
commit | 4285674ab37c74a24b265ace4d15d4848457d375 (patch) | |
tree | 942e238649c42f8077b2933989c977584d039067 /src/ToDo-UI | |
parent | c95dbbbf5080cf144e07a134c3e30668085d2e41 (diff) | |
download | ToDo-App-FE-4285674ab37c74a24b265ace4d15d4848457d375.tar.gz ToDo-App-FE-4285674ab37c74a24b265ace4d15d4848457d375.zip |
Pagination now works on to do's list.
Only 10 to dos will be shown at a time. You can sort by priority or due
date and it should work on all of our to dos. Edit and delete also
works.
Diffstat (limited to '')
-rw-r--r-- | src/ToDo-UI/ListToDo.jsx | 18 |
1 files changed, 7 insertions, 11 deletions
diff --git a/src/ToDo-UI/ListToDo.jsx b/src/ToDo-UI/ListToDo.jsx index 781f4cd..d57642b 100644 --- a/src/ToDo-UI/ListToDo.jsx +++ b/src/ToDo-UI/ListToDo.jsx @@ -5,10 +5,10 @@ import { remove_todo, edit_todo, set_sort_todo, - sort_todo, - refresh_filtered_todos, select_todos, + select_current_filters, select_current_sorting, + select_current_page, } from "../features/todo/reducer"; import { @@ -18,6 +18,8 @@ import { set_undone_function, } from "../api/axios_methods"; +import { refresh_todos } from "../refreshToDos"; + function sort_table_header(prefix, current_sorting) { if (prefix.toLowerCase().startsWith(current_sorting.substr(0, 3))) { switch (current_sorting.substr(-1)) { @@ -49,7 +51,7 @@ function sort_table_header(prefix, current_sorting) { function list_of_todos(edit_button, delete_button) { const dispatch = useDispatch(); const my_todos = useSelector(select_todos); - const my_sorting = useSelector(select_current_sorting); + const my_sorters = useSelector(select_current_sorting); function handle_sort_todos(where_clicked) { dispatch( @@ -57,8 +59,6 @@ function list_of_todos(edit_button, delete_button) { where_clicked: where_clicked, }) ); - dispatch(sort_todo()); - dispatch(refresh_filtered_todos()); } const set_done_api = set_done_function(); @@ -79,7 +79,7 @@ function list_of_todos(edit_button, delete_button) { <th scope="col">Done</th> <th scope="col">Name</th> <th scope="col" onClick={() => handle_sort_todos("priority")}> - {sort_table_header("Priority", my_sorting)} + {sort_table_header("Priority", my_sorters)} </th> <th scope="col" @@ -87,7 +87,7 @@ function list_of_todos(edit_button, delete_button) { handle_sort_todos("due_date"); }} > - {sort_table_header("Due Date", my_sorting)} + {sort_table_header("Due Date", my_sorters)} </th> <th scope="col">Actions</th> </tr> @@ -115,7 +115,6 @@ function list_of_todos(edit_button, delete_button) { done: e.target.checked, }) ); - dispatch(refresh_filtered_todos()); }} ></input> </div> @@ -221,8 +220,6 @@ export function ListToDos() { priority: edit_priority, }) ); - dispatch(sort_todo()); - dispatch(refresh_filtered_todos()); handle_exit_modal(); } @@ -256,7 +253,6 @@ export function ListToDos() { onClick={(e) => { remove_todo_api({ id: item.id }); dispatch(remove_todo(item.id)); - dispatch(refresh_filtered_todos()); }} > Delete |