Add UI pagination, update Redux and API service lib

This commit is contained in:
Nathan Barber
2021-05-05 18:41:48 -04:00
parent 5e2ca7bcff
commit 0439a0d274
14 changed files with 334 additions and 149 deletions

View File

@@ -5,25 +5,33 @@ export const initialState = {
user_page: 0,
groups_data: undefined,
groups_page: 0,
limit: 50,
manage_groups_modal: false,
limit: 3,
};
export const reducers = (state = initialState, action) => {
switch (action.type) {
case "USER_DATA":
return Object.assign({}, state, { user_data: action.value });
// Updates the client user model data and stores the page
case "USER_PAGE":
return Object.assign({}, state, {
user_page: action.value.page,
user_data: action.value.data,
});
// Deprecated - doesn't store pagination values
case "USER_DATA":
return Object.assign({}, state, { user_data: action.value });
// Updates the client group model data and stores the page
case "GROUPS_PAGE":
return Object.assign({}, state, {
groups_page: action.value.page,
groups_data: action.value.data,
});
// Deprecated - doesn't store pagination values
case "GROUPS_DATA":
return Object.assign({}, state, { groups_data: action.value });
case "TOGGLE_MANAGE_GROUPS_MODAL":
return Object.assign({}, state, {
manage_groups_modal: !state.manage_groups_modal,
});
default:
return state;
}