Created the validation util
This commit is contained in:
1 file changed
+7
@@ -0,0 +1,7 @@
|
|||||||
|
import Joi from "joi";
|
||||||
|
|
||||||
|
export const validateSchema = (schema: Joi.ObjectSchema, object: any) => {
|
||||||
|
const {error} = schema.validate(object, {errors: {wrap: {label: ''}}})
|
||||||
|
|
||||||
|
return error ? error.details[0].message : undefined;
|
||||||
|
}
|
||||||
Reference in new issue
Block a user