Last active
September 1, 2018 17:54
-
-
Save suzdalnitski/0303bad1e798bb230b36738ae9854629 to your computer and use it in GitHub Desktop.
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
import { withHandlers } from "recompose"; | |
import axios from "axios"; | |
const handleSubmit = ({ | |
email, | |
password, | |
emailError, | |
passwordError, | |
confirmPasswordError | |
}) => { | |
if (emailError || passwordError || confirmPasswordError) { | |
return; | |
} | |
const data = { | |
email: email.value, | |
password: password.value | |
}; | |
axios.post(`https://mywebsite.com/api/signup`, data); | |
}; | |
const withSubmitForm = withHandlers({ | |
onSubmit: (props) => () => handleSubmit(props) | |
}); | |
export default withSubmitForm; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment