Created
March 14, 2022 20:17
-
-
Save susimsek/19f526f15f2af7d7aff6bbcd458bdf37 to your computer and use it in GitHub Desktop.
Hateoas Capability Component
This file contains hidden or 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
| const {postLink} = useSelector((store) => ({ | |
| postLink: store.capability.links.capabilities.href | |
| })); | |
| const onSubmit = async e => { | |
| e.preventDefault(); | |
| const newCapability = { | |
| techStack, | |
| numOfDevelopers, | |
| numOfAvailableDevelopers | |
| }; | |
| try { | |
| let response = Promise.resolve(dispatch(addCapabilityHandler(newCapability, postLink))); | |
| await response; | |
| closeModal(); | |
| } catch (error) { | |
| dispatch(getErrors(error.response.data)); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment