Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

catch errors during onSubmit #226

Merged
merged 1 commit into from
Jan 12, 2018
Merged

catch errors during onSubmit #226

merged 1 commit into from
Jan 12, 2018

Conversation

z-vr
Copy link
Contributor

@z-vr z-vr commented Jan 11, 2018

This allows to handle onSubmit errors in onSubmitFailure, e.g.,

onSubmit={async (result) => {
    await fetchData('/api', result);
}}
onSubmitFailure={(validationErrors, formApi, fetchError) => {
    this.setState({ fetchError, validationErrors });
}}

@joepuzzo
Copy link
Contributor

Wow I love that you wrote unit tests for this!.. looks good I will pull.

@joepuzzo joepuzzo merged commit 01c2bc2 into TanStack:master Jan 12, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants