From 7ac0289e535dfb2e4f0502d78ed6eb556870deac Mon Sep 17 00:00:00 2001 From: Heorhii Shvab Date: Fri, 3 Jan 2025 11:54:14 +0200 Subject: [PATCH] Added error messages for admin dashboard forms --- .../create-country-form/CreateCountryForm.tsx | 5 +++++ .../country-form/edit-country-form/EditCountryForm.tsx | 5 +++++ core/src/containers/forms/country-form/styles.scss | 9 ++++++++- .../create-indicator-form/CreateIndicatorForm.tsx | 5 +++++ .../edit-indicator-form/EditIndicatorForm.tsx | 5 +++++ core/src/containers/forms/indicator-form/styles.scss | 9 ++++++++- .../value-form/create-value-form/CreateValueForm.tsx | 5 +++++ .../forms/value-form/edit-value-form/EditValueForm.tsx | 5 +++++ core/src/containers/forms/value-form/styles.scss | 9 ++++++++- 9 files changed, 54 insertions(+), 3 deletions(-) diff --git a/core/src/containers/forms/country-form/create-country-form/CreateCountryForm.tsx b/core/src/containers/forms/country-form/create-country-form/CreateCountryForm.tsx index 22190ca..784b41c 100644 --- a/core/src/containers/forms/country-form/create-country-form/CreateCountryForm.tsx +++ b/core/src/containers/forms/country-form/create-country-form/CreateCountryForm.tsx @@ -49,6 +49,8 @@ const CreateCountryForm: FC = ({ onSuccess }) => { resolver: yupResolver(createCountryValidationSchema), }) + const errorMsg = Object.values(errors)[0]?.message + const handleTagsChange = (tags: string[]) => { setValue("searchTags", tags, { shouldDirty: true }) } @@ -118,6 +120,9 @@ const CreateCountryForm: FC = ({ onSuccess }) => { +

+ {errorMsg ? errorMsg : <> } +