From e0ce800a647a1b173979f0e7f20d1d54b9f9bd7d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Adri=C3=A1n=20Oliva?= <adrian.oliva@cimat.mx>
Date: Mon, 29 May 2023 18:34:49 -0600
Subject: Search working with database.

---
 src/App.jsx            |  2 --
 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 (
-- 
cgit v1.2.3