Archived
2

minor fixes

This commit is contained in:
VLE2FE
2020-07-14 12:07:43 +02:00
parent 758eb0e143
commit 3dda3d77a1
5 changed files with 18 additions and 4 deletions

View File

@ -182,8 +182,8 @@ export default class SampleValidate {
validator = Joi.object({
value: Joi.alternatives()
.try(
Joi.string().max(128),
Joi.number(),
Joi.string().max(128),
Joi.boolean(),
Joi.array()
)
@ -195,6 +195,7 @@ export default class SampleValidate {
validator = Joi.object(this.sample);
}
const {value, error} = validator.validate({[field]: e});
console.log(value);
if (error) throw error; // reject invalid values // TODO: return exact error description, handle in frontend filters
return value[field];
});

View File

@ -1,6 +1,7 @@
import Joi from '@hapi/joi';
import IdValidate from './id';
// TODO: do not allow a . in the name
export default class TemplateValidate {
private static template = {
name: Joi.string()