Skip to content

Instantly share code, notes, and snippets.

@wbobeirne
Created May 7, 2019 22:50
Show Gist options
  • Save wbobeirne/e5781e3cd87145c5f3ac739b58b20fd7 to your computer and use it in GitHub Desktop.
Save wbobeirne/e5781e3cd87145c5f3ac739b58b20fd7 to your computer and use it in GitHub Desktop.
handleSubmit = (ev: React.FormEvent) => {
const { name, content } = this.state;
ev.preventDefault();
this.setState({
isPosting: true,
error: null,
});
api.submitPost(name, content)
.then(res => {
this.setState({
isPosting: false,
pendingPost: res.post,
paymentRequest: res.paymentRequest,
});
this.checkIfPaid();
}).catch(err => {
this.setState({
isPosting: false,
error: err.message,
})
});
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment