cic-staff-client/src/app/_helpers/schema-validation.ts

20 lines
645 B
TypeScript
Raw Normal View History

2021-05-15 11:50:13 +02:00
import { validatePerson, validateVcard } from '@cicnet/schemas-data-validator';
async function personValidation(person: any): Promise<void> {
const personValidationErrors: any = await validatePerson(person);
if (personValidationErrors) {
2021-05-18 12:24:41 +02:00
personValidationErrors.map((error) => console.error(`${error.message}`, person, error));
}
}
async function vcardValidation(vcard: any): Promise<void> {
const vcardValidationErrors: any = await validateVcard(vcard);
if (vcardValidationErrors) {
2021-05-18 12:24:41 +02:00
vcardValidationErrors.map((error) => console.error(`${error.message}`, vcard, error));
}
}
2021-05-10 18:15:25 +02:00
export { personValidation, vcardValidation };