Files
jupyterhub/jsx/src/Store.js
Min RK fd78a03280 move pagination state entirely to URL params
don't duplicate it state variables
2024-03-06 00:23:38 +01:00

28 lines
664 B
JavaScript

export const initialState = {
user_data: undefined,
user_page: undefined,
groups_data: undefined,
groups_page: undefined,
limit: window.api_page_limit || 100,
};
export const reducers = (state = initialState, action) => {
switch (action.type) {
// 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,
});
case "GROUPS_PAGE":
return Object.assign({}, state, {
groups_page: action.value.page,
groups_data: action.value.data,
});
default:
return state;
}
};