Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

misc: add error message if external id already exist #1586

Merged
merged 1 commit into from
Jul 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion ditto/base.json
Original file line number Diff line number Diff line change
Expand Up @@ -2272,5 +2272,6 @@
"text_66474faf77c70900619567c7": "Forbidden access",
"text_66474fb55f1b6901c7ac7683": "It seems you don’t have the permission to access this page. If you think this is an error contact an admin of your organization.",
"text_665deda4babaf700d603ea13": "Leaving without saving",
"text_665dedd557dc3c00c62eb83d": "By clicking 'Leave', any unsaved data will be lost. Are you sure you want to continue?"
"text_665dedd557dc3c00c62eb83d": "By clicking 'Leave', any unsaved data will be lost. Are you sure you want to continue?",
"text_668513bb1906740145e06abe": "Value already exist, please type a new one."
}
7 changes: 6 additions & 1 deletion src/pages/CreateSubscription.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ const CreateSubscription = () => {
}),
validateOnMount: true,
enableReinitialize: true,
onSubmit: async (values) => {
onSubmit: async (values, formikBag) => {
const localValues = {
id: formType === FORM_TYPE_ENUM.edition ? subscription?.id : undefined,
...values,
Expand All @@ -287,6 +287,11 @@ const CreateSubscription = () => {
if (errorsString === 'CurrenciesDoesNotMatch') {
isResponsive && rootElement?.scrollTo({ top: 0, behavior: 'smooth' })
return setShowCurrencyError(true)
} else if (errorsString === 'ValueAlreadyExist') {
rootElement?.scrollTo({ top: 0, behavior: 'smooth' })
formikBag.setErrors({
externalId: translate('text_668513bb1906740145e06abe'),
})
}
},
})
Expand Down
Loading