Skip to content

Commit

Permalink
minor fix
Browse files Browse the repository at this point in the history
  • Loading branch information
PierreVasseur committed Feb 21, 2024
1 parent 33928d5 commit 072d8d5
Showing 1 changed file with 0 additions and 27 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,33 +2,6 @@ import D, { D1, D2 } from 'js/i18n';
import { formatValidation } from 'js/utils/validation';
import { z } from 'zod';

export const validate2 = (component) => {
const errorMessage = [];
const fields = {};

if (!component.identifiant) {
errorMessage.push(D.mandatoryProperty(D.idTitle));
fields.identifiant = D.mandatoryProperty(D.idTitle);
}
if (!component.labelLg1) {
errorMessage.push(D.mandatoryProperty(D1.labelTitle));
fields.labelLg1 = D.mandatoryProperty(D1.labelTitle);
}
if (!component.labelLg2) {
errorMessage.push(D.mandatoryProperty(D2.labelTitle));
fields.labelLg2 = D.mandatoryProperty(D2.labelTitle);
}
if (!component.type) {
errorMessage.push(D.mandatoryProperty(D1.type));
fields.type = D.mandatoryProperty(D.type);
}

return {
errorMessage,
fields,
};
};

const Component = z.object({
identifiant: z.string({ required_error: D.mandatoryProperty(D.idTitle) }).min(1, { message: D.mandatoryProperty(D.idTitle) }),
labelLg1: z.string({ required_error: D.mandatoryProperty(D1.labelTitle) }).min(1, { message: D.mandatoryProperty(D1.labelTitle) }),
Expand Down

0 comments on commit 072d8d5

Please sign in to comment.