diff options
author | Adrián Oliva <adrian.oliva@cimat.mx> | 2023-05-28 14:24:41 -0600 |
---|---|---|
committer | Adrián Oliva <adrian.oliva@cimat.mx> | 2023-05-28 14:24:41 -0600 |
commit | 2082070fa9d79fe0702441f814f920095d1393c9 (patch) | |
tree | 071d24eb3b0d7cf618e3491f3aa132693ea35ba4 /src/App.jsx | |
parent | 117b8c82ef02b95d289cd1ad22f226828918a18b (diff) | |
download | ToDo-App-FE-2082070fa9d79fe0702441f814f920095d1393c9.tar.gz ToDo-App-FE-2082070fa9d79fe0702441f814f920095d1393c9.zip |
Little bug on last index.
Because the Front End wasn't tracking the deleted items, the indexes
between the database and the front end were not matching.
Diffstat (limited to '')
-rw-r--r-- | src/App.jsx | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/src/App.jsx b/src/App.jsx index 6f1b14f..b39d5d9 100644 --- a/src/App.jsx +++ b/src/App.jsx @@ -4,9 +4,13 @@ import { NewToDo } from "./ToDo-UI/NewToDo"; import { ListToDos } from "./ToDo-UI/ListToDo"; import { useDispatch } from "react-redux"; -import { set_todo, refresh_filtered_todos } from "./features/todo/reducer"; +import { + set_last_id, + set_todo, + refresh_filtered_todos, +} from "./features/todo/reducer"; -import { get_todos_function } from "./api/axios_methods"; +import { get_todos_function, get_last_id_function } from "./api/axios_methods"; function App() { const get_todos = get_todos_function(); @@ -37,6 +41,15 @@ function App() { } get_todos(handler); + const last_id_api = get_last_id_function(); + last_id_api((response) => { + dispatch( + set_last_id({ + id: response, + }) + ); + }); + return ( <div> <Search /> |