From f25a2a1c9671ae58872fa027c4ec978997021f2d Mon Sep 17 00:00:00 2001 From: Kurund Jalmi Date: Fri, 24 Nov 2023 23:49:46 +0000 Subject: [PATCH] remove unnecessary validations --- src/containers/Template/Form/Template.tsx | 30 ----------------------- 1 file changed, 30 deletions(-) diff --git a/src/containers/Template/Form/Template.tsx b/src/containers/Template/Form/Template.tsx index 6cecca0a1..e0ee0a341 100644 --- a/src/containers/Template/Form/Template.tsx +++ b/src/containers/Template/Form/Template.tsx @@ -182,7 +182,6 @@ const Template = ({ const [label, setLabel] = useState(''); const [body, setBody] = useState(EditorState.createEmpty()); const [example, setExample] = useState(EditorState.createEmpty()); - const [filterLabel, setFilterLabel] = useState(''); const [shortcode, setShortcode] = useState(''); const [language, setLanguageId] = useState({}); const [type, setType] = useState(null); @@ -479,12 +478,6 @@ const Template = ({ } }, [languages]); - useEffect(() => { - if (filterLabel && language && language.id) { - getSessionTemplates(); - } - }, [filterLabel, language, getSessionTemplates]); - useEffect(() => { setShortcode(getShortcode); }, [getShortcode]); @@ -543,28 +536,6 @@ const Template = ({ return ; } - const validateTitle = (value: any) => { - let error; - if (value) { - setFilterLabel(value); - let found = []; - if (sessionTemplates) { - if (getSessionTemplatesCallBack) { - getSessionTemplatesCallBack(sessionTemplates); - } - // need to check exact title - found = sessionTemplates.sessionTemplates.filter((search: any) => search.label === value); - if (params.id && found.length > 0) { - found = found.filter((search: any) => search.id !== params.id); - } - } - if (found.length > 0) { - error = t('Title already exists.'); - } - } - return error; - }; - const updateTranslation = (value: any) => { const translationId = value.id; // restore if selected language is same as template @@ -709,7 +680,6 @@ const Template = ({ component: Input, name: 'label', placeholder: `${t('Title')}*`, - validate: validateTitle, disabled: !!(defaultAttribute.isHsm && params.id), helperText: defaultAttribute.isHsm ? t('Define what use case does this template serve eg. OTP, optin, activity preference')