Skip to content

Commit

Permalink
fix: add better error message for picklist
Browse files Browse the repository at this point in the history
  • Loading branch information
MichaelTaylor3D committed Aug 9, 2022
1 parent 9dd66f9 commit fdbc4f8
Showing 1 changed file with 15 additions and 15 deletions.
30 changes: 15 additions & 15 deletions src/utils/validation-utils.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
import { getPicklistValues } from './data-loaders';

export const pickListValidation = (field, name) => (value, helper) => {
const pickList = getPicklistValues();

if (pickList[field].includes(value)) {
return value;
}

return helper.message(
`${name || field} does not include a valid option ${pickList[field].join(
', ',
)}`,
);
};
import { getPicklistValues } from './data-loaders';

export const pickListValidation = (field, name) => (value, helper) => {
const pickList = getPicklistValues();

if (pickList[field].includes(value)) {
return value;
}

return helper.message(
`${name || field} does not include a valid option ${pickList[field].join(
', ',
)} instead got '${value}'`,
);
};

0 comments on commit fdbc4f8

Please sign in to comment.