diff --git a/packages/console/src/components/CreateTenantModal/index.tsx b/packages/console/src/components/CreateTenantModal/index.tsx index d8a5b7824..2f40cb0cd 100644 --- a/packages/console/src/components/CreateTenantModal/index.tsx +++ b/packages/console/src/components/CreateTenantModal/index.tsx @@ -19,6 +19,7 @@ import RadioGroup, { Radio } from '@/ds-components/RadioGroup'; import TextInput from '@/ds-components/TextInput'; import useTheme from '@/hooks/use-theme'; import modalStyles from '@/scss/modal.module.scss'; +import { trySubmitSafe } from '@/utils/form'; import EnvTagOptionContent from './EnvTagOptionContent'; import SelectTenantPlanModal from './SelectTenantPlanModal'; @@ -57,16 +58,18 @@ function CreateTenantModal({ isOpen, onClose }: Props) { }; const { t } = useTranslation(undefined, { keyPrefix: 'admin_console' }); - const onCreateClick = handleSubmit(async (data: CreateTenantData) => { - const { tag } = data; - if (tag === TenantTag.Development) { - await createTenant(data); - toast.success(t('tenants.create_modal.tenant_created')); - return; - } + const onCreateClick = handleSubmit( + trySubmitSafe(async (data: CreateTenantData) => { + const { tag } = data; + if (tag === TenantTag.Development) { + await createTenant(data); + toast.success(t('tenants.create_modal.tenant_created')); + return; + } - setTenantData(data); - }); + setTenantData(data); + }) + ); return (