Created
August 23, 2019 17:25
-
-
Save msaaddev/d65fe91558bdfec4e1a5706ca90ef4a1 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
validate = () => { | |
const options = { abortEarly: false }; | |
const { error } = Joi.validate(this.state.data, this.schema, options); | |
if (!error) return null; | |
const errors = {}; | |
for (let item of error.details) errors[item.path[0]] = item.message; | |
return errors; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment