Created
March 14, 2022 19:48
-
-
Save susimsek/c5f4555d4a3e28e3843e520b79932cdd to your computer and use it in GitHub Desktop.
Hateoas Redux
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export const getAllCapabilitiesHandler = (getLink) => async dispatch => { | |
try { | |
const res = await getAllCapabilities(getLink); | |
dispatch({ | |
type: GET_CAPABILITIES, | |
payload: res.data._embedded ? res.data._embedded.capabilities : [], | |
links: res.data._links, | |
page: res.data.page | |
}); | |
} catch (error) { | |
dispatch({ | |
type: GET_CAPABILITIES, | |
payload: [], | |
links: {}, | |
page: { | |
totalPages: 0 | |
} | |
}); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment