Skip to content

Commit

Permalink
added validation
Browse files Browse the repository at this point in the history
  • Loading branch information
akanshaaa19 committed Jan 8, 2025
1 parent 42255e7 commit 6c2d570
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions src/containers/HSM/HSM.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -641,10 +641,19 @@ export const HSM = () => {
otherwise: (schema) => schema.nullable(),
}),
templateButtons: Yup.array().of(
Yup.object().shape({
type: Yup.string().required('Type is required.'),
title: Yup.string().required('Title is required.'),
value: Yup.string().required('Value is required.'),
Yup.lazy(() => {
if (templateType === 'CALL_TO_ACTION') {
return Yup.object().shape({
type: Yup.string().required('Type is required.'),
title: Yup.string().required('Title is required.'),
value: Yup.string().required('Value is required.'),
});
} else if (templateType === 'QUICK_REPLY') {
return Yup.object().shape({
value: Yup.string().required('Value is required.'),
});
}
return Yup.object().shape({});
})
),
};
Expand Down

0 comments on commit 6c2d570

Please sign in to comment.