Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
(() => {
const allLocales =
LocalizedTextInput.isTouched(
this.props.formik.touched.slug
) && this.props.formik.errors.slug
? // We map on the per-field errors which are present on
// the "translations" field
this.props.formik.errors.slug.translations
: {};
return Object.entries(allLocales).reduce(
(acc, [key, error]) => {
const value = error.hasForbiddenChars ? (
This slug is not valid.
) : (
undefined
);
return {
[key]: value,
*/}
Product name*
{LocalizedTextInput.isTouched(this.props.formik.touched.name) &&
this.props.formik.errors.name &&
this.props.formik.errors.name.missing && (
// The LocalizedTextInput provides a generic default message
// when it is a required field and values are missing
// It is also possible to use a custom, more detailed error
// message as shown on the example below (the slug)
)}
<div>
Slug*
The slug can contain alphanumeric characters (0-9 or A-Z),
underscores or hyphens with no spaces, and can be anywhere between 2
to 256 characters long.
</div>
This slug is not valid.
) : (
undefined
);
return {
[key]: value,
...acc,
};
},
{}
);
})()
}
/>
{LocalizedTextInput.isTouched(this.props.formik.touched.slug) &&
this.props.formik.errors.slug &&
this.props.formik.errors.slug.missing && (
// This shows how a detailed custom error message can be used
// for LocalizedTextInput
Missing slug. At least one field must be filled.
)}
<div>
Product Description*
</div>