aboutsummaryrefslogtreecommitdiff
path: root/src/features/todo
diff options
context:
space:
mode:
authorAdrián Oliva <adrian.oliva@cimat.mx>2023-05-29 12:42:46 -0600
committerAdrián Oliva <adrian.oliva@cimat.mx>2023-05-29 12:42:46 -0600
commit4285674ab37c74a24b265ace4d15d4848457d375 (patch)
tree942e238649c42f8077b2933989c977584d039067 /src/features/todo
parentc95dbbbf5080cf144e07a134c3e30668085d2e41 (diff)
downloadToDo-App-FE-4285674ab37c74a24b265ace4d15d4848457d375.tar.gz
ToDo-App-FE-4285674ab37c74a24b265ace4d15d4848457d375.zip
Pagination now works on to do's list.
Only 10 to dos will be shown at a time. You can sort by priority or due date and it should work on all of our to dos. Edit and delete also works.
Diffstat (limited to 'src/features/todo')
-rw-r--r--src/features/todo/reducer.js13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/features/todo/reducer.js b/src/features/todo/reducer.js
index 210fb05..8a2e9b8 100644
--- a/src/features/todo/reducer.js
+++ b/src/features/todo/reducer.js
@@ -14,6 +14,8 @@ export const todo_slice = createSlice({
priority: "All",
state: "All",
},
+
+ page_selected: 1,
},
reducers: {
@@ -128,6 +130,14 @@ export const todo_slice = createSlice({
state: action.payload.state,
};
},
+
+ empty_todos: (state) => {
+ state.todos = [];
+ },
+
+ change_page: (state, action) => {
+ state.page_selected = action.payload.page;
+ },
},
});
@@ -140,6 +150,8 @@ export const {
edit_todo,
set_sort_todo,
set_filters,
+ empty_todos,
+ change_page,
} = todo_slice.actions;
export const select_todos = (state) => state.todo_list.todos;
@@ -148,5 +160,6 @@ export const select_current_sorting = (state) =>
state.todo_list.current_sorting;
export const select_current_filters = (state) =>
state.todo_list.current_filters;
+export const select_current_page = (state) => state.todo_list.page_selected;
export default todo_slice.reducer;