Skip to content

Instantly share code, notes, and snippets.

@pradumangoyal
Created December 9, 2018 14:52
Show Gist options
  • Save pradumangoyal/fe8c793542fb8e7eaf3a02ac27fa286c to your computer and use it in GitHub Desktop.
Save pradumangoyal/fe8c793542fb8e7eaf3a02ac27fa286c to your computer and use it in GitHub Desktop.
handleSubmit = () => {
if(this.state.captcha){
let headers = {
'X-CSRFToken': getCookie('csrftoken')
}
let data = {
information: this.state.information,
'g-recaptcha-response': this.state["g-recaptcha-response"]
}
axios.post(urlContactMe(), data, {headers: headers})
.then(res =>
{this.setState({
information: '',
})
})
.catch(err => {console.log(err)})
}
//To reset captcha
recaptchaRef.current.reset()
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment