diff options
author | Adrián Oliva <adrian.oliva@cimat.mx> | 2023-05-29 18:34:49 -0600 |
---|---|---|
committer | Adrián Oliva <adrian.oliva@cimat.mx> | 2023-05-29 18:34:49 -0600 |
commit | e0ce800a647a1b173979f0e7f20d1d54b9f9bd7d (patch) | |
tree | 7eff32840ea90bc4c857e0d38d3325f362aa9af5 /src/ToDo-UI | |
parent | daee56ba5509a4576fa066adfcc0d1bc05f98802 (diff) | |
download | ToDo-App-FE-e0ce800a647a1b173979f0e7f20d1d54b9f9bd7d.tar.gz ToDo-App-FE-e0ce800a647a1b173979f0e7f20d1d54b9f9bd7d.zip |
Search working with database.
Diffstat (limited to '')
-rw-r--r-- | src/ToDo-UI/Search.jsx | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/src/ToDo-UI/Search.jsx b/src/ToDo-UI/Search.jsx index e264929..fc78e46 100644 --- a/src/ToDo-UI/Search.jsx +++ b/src/ToDo-UI/Search.jsx @@ -1,6 +1,14 @@ import React, { useState } from "react"; -import { useSelector, useDispatch } from "react-redux"; -import { set_filters, refresh_filtered_todos } from "../features/todo/reducer"; +import { useDispatch, useSelector } from "react-redux"; +import { set_filters } from "../features/todo/reducer"; + +import { + select_current_filters, + select_current_sorting, + select_current_page, +} from "../features/todo/reducer"; + +import { refresh_todos } from "../refreshToDos"; export function Search() { const dispatch = useDispatch(); @@ -9,6 +17,10 @@ export function Search() { const [search_priority, set_search_priority] = useState("All"); const [search_state, set_search_state] = useState("All"); + const my_filters = useSelector(select_current_filters); + const my_sorters = useSelector(select_current_sorting); + const my_curr_page = useSelector(select_current_page); + function handle_search() { dispatch( set_filters({ @@ -17,7 +29,7 @@ export function Search() { state: search_state, }) ); - dispatch(refresh_filtered_todos()); + refresh_todos(my_filters, my_sorters, my_curr_page, dispatch); } return ( |