diff options
-rw-r--r-- | src/App.jsx | 2 | ||||
-rw-r--r-- | src/ToDo-UI/Search.jsx | 18 |
2 files changed, 15 insertions, 5 deletions
diff --git a/src/App.jsx b/src/App.jsx index 9ef710e..dd81431 100644 --- a/src/App.jsx +++ b/src/App.jsx @@ -10,8 +10,6 @@ import { select_current_page, } from "./features/todo/reducer"; -import { get_last_id_function } from "./api/axios_methods"; - import { refresh_todos } from "./refreshToDos"; function App() { 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 ( |