Skip to content

Instantly share code, notes, and snippets.

@amosuro
Created November 5, 2018 12:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save amosuro/4a8493d8c5b200c28d98d5cf71151476 to your computer and use it in GitHub Desktop.
Save amosuro/4a8493d8c5b200c28d98d5cf71151476 to your computer and use it in GitHub Desktop.
submitForm() {
const {name, email, message} = this.formElement.current.elements;
const payload = {
url: 'api/contact',
name: name,
email: email,
message: message,
};
post(payload)
.then(() => {
this.setState({error: null, submitted: true});
})
.catch(error => {
this.setState({error: error.message, submitted: false});
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment