Merge pull request #88 from ctk-hq/fix/yup-errors

fix: yup error a list of objects
pull/89/head
Artem Golub 3 years ago committed by GitHub
commit eaa77655dc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -208,8 +208,17 @@ export const reportErrorsAndSubmit = (formik: any) => () => {
if (errors.length > 0) {
// eslint-disable-next-line @typescript-eslint/no-unused-vars
for (const [_field, message] of errors) {
if (Array.isArray(message)) {
message.forEach((m: object) => {
// eslint-disable-next-line @typescript-eslint/no-unused-vars
for (const [_, value] of Object.entries(m)) {
toaster(value as string, "error");
}
});
} else {
toaster(message as string, "error");
}
}
} else {
formik.submitForm();
}

Loading…
Cancel
Save