fast fix
This commit is contained in:
parent
46031a5fd2
commit
c12338410f
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "axp-server",
|
"name": "axp-server",
|
||||||
"version": "1.4.13",
|
"version": "1.4.14",
|
||||||
"description": "My helper library",
|
"description": "My helper library",
|
||||||
"author": "AntoXa PRO <info@antoxa.pro>",
|
"author": "AntoXa PRO <info@antoxa.pro>",
|
||||||
"homepage": "https://antoxahub.ru/antoxa/axp-server",
|
"homepage": "https://antoxahub.ru/antoxa/axp-server",
|
||||||
|
@ -94,16 +94,3 @@ export const zodMiddle =
|
|||||||
next(httpError)
|
next(httpError)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export const validFormMiddle =
|
|
||||||
(model: IFormModel<any>) =>
|
|
||||||
(req: Request, {}: Response, next: NextFunction) => {
|
|
||||||
if (model.isValid()) {
|
|
||||||
req.body = model.obj
|
|
||||||
next()
|
|
||||||
} else {
|
|
||||||
const httpError = new HttpError({ statusCode: 400 })
|
|
||||||
httpError.errors = model.errors
|
|
||||||
next(httpError)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
Loading…
Reference in New Issue
Block a user