Skip to content

Instantly share code, notes, and snippets.

@suzdalnitski
Last active September 1, 2018 17:54
Show Gist options
  • Save suzdalnitski/0303bad1e798bb230b36738ae9854629 to your computer and use it in GitHub Desktop.
Save suzdalnitski/0303bad1e798bb230b36738ae9854629 to your computer and use it in GitHub Desktop.
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