aboutsummaryrefslogtreecommitdiff
path: root/src/features/todo
diff options
context:
space:
mode:
authorAdrián Oliva <adrian.oliva@cimat.mx>2023-05-28 14:24:41 -0600
committerAdrián Oliva <adrian.oliva@cimat.mx>2023-05-28 14:24:41 -0600
commit2082070fa9d79fe0702441f814f920095d1393c9 (patch)
tree071d24eb3b0d7cf618e3491f3aa132693ea35ba4 /src/features/todo
parent117b8c82ef02b95d289cd1ad22f226828918a18b (diff)
downloadToDo-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 'src/features/todo')
-rw-r--r--src/features/todo/reducer.js5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/features/todo/reducer.js b/src/features/todo/reducer.js
index 16fc427..118e482 100644
--- a/src/features/todo/reducer.js
+++ b/src/features/todo/reducer.js
@@ -17,6 +17,10 @@ export const todo_slice = createSlice({
},
reducers: {
+ set_last_id: (state, action) => {
+ state.last_id = action.payload.id;
+ },
+
add_todo: (state, action) => {
state.todos = [
...state.todos,
@@ -196,6 +200,7 @@ export const todo_slice = createSlice({
});
export const {
+ set_last_id,
add_todo,
set_todo,
change_done,