Skip to content

Instantly share code, notes, and snippets.

@gabrielhpugliese
Last active March 7, 2016 15:35
Show Gist options
  • Save gabrielhpugliese/70efb963cf51038dd9d1 to your computer and use it in GitHub Desktop.
Save gabrielhpugliese/70efb963cf51038dd9d1 to your computer and use it in GitHub Desktop.
onSubmit={this.props.handleSubmit((values) => {
return new Promise((resolve, reject) => {
this.handleSubmitTest(values)
.then(() => resolve(), err => {
reject(err);
});
}
})}
onSubmit={this.props.handleSubmit((values) => {
return new Promise((resolve, reject) => {
const errors = this.handleSubmitTest(values);
// You can use lodash to see if it is empty
if (! isEmpty(errors)) {
return reject(errors);
}
return resolve();
}
})}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment