Created the validation util
This commit is contained in:
parent
0e04039c15
commit
1514edad54
7
util/validate.ts
Normal file
7
util/validate.ts
Normal file
@ -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;
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user