Skip to content

Instantly share code, notes, and snippets.

@sudipt1999
Last active February 10, 2020 15:16
Show Gist options
  • Save sudipt1999/5c9143f890b4408df9a8c489e2e6187a to your computer and use it in GitHub Desktop.
Save sudipt1999/5c9143f890b4408df9a8c489e2e6187a to your computer and use it in GitHub Desktop.
onSubmitHandler = (e) => {
e.preventDefault()
alert("submit code")
axios.post(`http:localhost:8000/code/submit`,this.state)
.then(res=>{
console.log(res.data)
const data = res.data
if(data.err){
// Error in user code
this.setState({
result: data.error
})
}else{
this.setState({
result: data.output
})
}
})
.catch(err=>{
console.log(err)
})
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment