Skip to content

Instantly share code, notes, and snippets.

@tsamaya
Created November 5, 2018 14:36
Show Gist options
  • Save tsamaya/e9ffc1d9d9235d4d777eeb57cbfe4e5e to your computer and use it in GitHub Desktop.
Save tsamaya/e9ffc1d9d9235d4d777eeb57cbfe4e5e to your computer and use it in GitHub Desktop.
handleSubmit(event) {
event.preventDefault();
this.setState({ isSubmitting: true });
opencage
.geocode({ key: this.state.apikey, q: this.state.query })
.then(response => {
console.log(response);
this.setState({ response, isSubmitting: false });
})
.catch(err => {
console.error(err);
this.setState({ response: {}, isSubmitting: false });
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment