Skip to content

Commit

Permalink
Merge pull request #937 from glific/keyword-validation
Browse files Browse the repository at this point in the history
Added validation for keyword
  • Loading branch information
mdshamoon authored Jan 23, 2021
2 parents 25a63fb + f34f7ad commit 25966bf
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/containers/Flow/Flow.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,11 @@ export interface FlowProps {
match: any;
}

const regex = /^[a-z]+(,[a-z]+)*$/g;

const FormSchema = Yup.object().shape({
name: Yup.string().required('Name is required.'),
keywords: Yup.string().matches(regex, 'Only lowercase are allowed.'),
});

const dialogMessage = "You won't be able to use this flow again.";
Expand Down Expand Up @@ -58,7 +61,7 @@ export const Flow: React.SFC<FlowProps> = ({ match }) => {
}
setName(fieldName);

// we are recieving keywords as an array object
// we are receiving keywords as an array object
if (fieldKeywords.length > 0) {
// lets display it comma separated
setKeywords(fieldKeywords.join(','));
Expand Down

0 comments on commit 25966bf

Please sign in to comment.