Created
March 7, 2016 15:43
-
-
Save gabrielhpugliese/2c7418a682a3f42ecb8d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<form | |
onSubmit={handleSubmit(values => ( | |
new Promise((resolve, reject) => { | |
// errorsForm returns an Object where keys are fields with errors and values are messages to show in form. | |
const errors = this.errorsForm(values); | |
if (! isEmpty(errors)) { | |
return reject(errors); | |
} | |
return postToMyServer(values) | |
.then(() => { | |
return resolve(); | |
}); | |
}))} | |
> | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment