From 2082070fa9d79fe0702441f814f920095d1393c9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adri=C3=A1n=20Oliva?= Date: Sun, 28 May 2023 14:24:41 -0600 Subject: 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. --- src/features/todo/reducer.js | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src/features/todo/reducer.js') 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, -- cgit v1.2.3