fix confirmation modal on subdomain settings (#12845)
before - https://github.com/user-attachments/assets/ff063912-0c1e-41e4-b01d-15081ecb04a1 after - https://github.com/user-attachments/assets/0ee6022d-f0a8-4243-a108-c4295d0fb560
This commit is contained in:
@ -68,7 +68,7 @@ export const SettingsDomain = () => {
|
||||
currentWorkspaceState,
|
||||
);
|
||||
|
||||
const { openModal } = useModal();
|
||||
const { openModal, closeModal } = useModal();
|
||||
|
||||
const form = useForm<{
|
||||
subdomain: string;
|
||||
@ -141,6 +141,7 @@ export const SettingsDomain = () => {
|
||||
error instanceof ApolloError &&
|
||||
error.graphQLErrors[0]?.extensions?.code === 'CONFLICT'
|
||||
) {
|
||||
closeModal(SUBDOMAIN_CHANGE_CONFIRMATION_MODAL_ID);
|
||||
return form.control.setError('subdomain', {
|
||||
type: 'manual',
|
||||
message: t`Subdomain already taken`,
|
||||
@ -203,6 +204,7 @@ export const SettingsDomain = () => {
|
||||
};
|
||||
|
||||
return (
|
||||
<>
|
||||
<form onSubmit={form.handleSubmit(handleSave)}>
|
||||
{/* eslint-disable-next-line react/jsx-props-no-spreading */}
|
||||
<FormProvider {...form}>
|
||||
@ -231,6 +233,8 @@ export const SettingsDomain = () => {
|
||||
<SettingsCustomDomain />
|
||||
</SettingsPageContainer>
|
||||
</SubMenuTopBarContainer>
|
||||
</FormProvider>
|
||||
</form>
|
||||
<ConfirmationModal
|
||||
modalId={SUBDOMAIN_CHANGE_CONFIRMATION_MODAL_ID}
|
||||
title={t`Change subdomain?`}
|
||||
@ -241,7 +245,6 @@ export const SettingsDomain = () => {
|
||||
updateSubdomain(values.subdomain, currentWorkspace);
|
||||
}}
|
||||
/>
|
||||
</FormProvider>
|
||||
</form>
|
||||
</>
|
||||
);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user