Skip to content

Instantly share code, notes, and snippets.

@susimsek
Created March 14, 2022 20:04
Show Gist options
  • Save susimsek/d4d30526fb5e520aa2544b906d5afd0b to your computer and use it in GitHub Desktop.
Save susimsek/d4d30526fb5e520aa2544b906d5afd0b to your computer and use it in GitHub Desktop.
Hateoas Redux Reducer
const initialState = {
capabilities: [],
capability: {},
links: {},
page: {
totalPages: 0,
totalElements: 0,
number: 0,
size: 3
}
};
export default function(state = initialState, action = {}) {
switch (action.type) {
case GET_CAPABILITIES:
return {
...state,
capabilities: action.payload,
links: action.links,
page: action.page
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment