wm-AllKids-tibi2023/api/hooks/forms/post_create.js
Grit-Grenzdoerfer 5f27fe0c5b Initial commit
2023-09-17 13:24:39 +02:00

15 lines
426 B
JavaScript

const { validateFields } = require("./validateFields")
;(function () {
if (context.data.formular.honey) {
throw { status: 400, error: "Bot detection" }
}
delete context.data.formular.honey
let values = Object.entries(context.data.formular)
let validation = validateFields(values)
console.log(validation)
if (validation.length) {
throw { status: 400, error: validation }
}
})()