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,
|
currentWorkspaceState,
|
||||||
);
|
);
|
||||||
|
|
||||||
const { openModal } = useModal();
|
const { openModal, closeModal } = useModal();
|
||||||
|
|
||||||
const form = useForm<{
|
const form = useForm<{
|
||||||
subdomain: string;
|
subdomain: string;
|
||||||
@ -141,6 +141,7 @@ export const SettingsDomain = () => {
|
|||||||
error instanceof ApolloError &&
|
error instanceof ApolloError &&
|
||||||
error.graphQLErrors[0]?.extensions?.code === 'CONFLICT'
|
error.graphQLErrors[0]?.extensions?.code === 'CONFLICT'
|
||||||
) {
|
) {
|
||||||
|
closeModal(SUBDOMAIN_CHANGE_CONFIRMATION_MODAL_ID);
|
||||||
return form.control.setError('subdomain', {
|
return form.control.setError('subdomain', {
|
||||||
type: 'manual',
|
type: 'manual',
|
||||||
message: t`Subdomain already taken`,
|
message: t`Subdomain already taken`,
|
||||||
@ -203,45 +204,47 @@ export const SettingsDomain = () => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<form onSubmit={form.handleSubmit(handleSave)}>
|
<>
|
||||||
{/* eslint-disable-next-line react/jsx-props-no-spreading */}
|
<form onSubmit={form.handleSubmit(handleSave)}>
|
||||||
<FormProvider {...form}>
|
{/* eslint-disable-next-line react/jsx-props-no-spreading */}
|
||||||
<SubMenuTopBarContainer
|
<FormProvider {...form}>
|
||||||
title={t`Domain`}
|
<SubMenuTopBarContainer
|
||||||
links={[
|
title={t`Domain`}
|
||||||
{
|
links={[
|
||||||
children: <Trans>Workspace</Trans>,
|
{
|
||||||
href: getSettingsPath(SettingsPath.Workspace),
|
children: <Trans>Workspace</Trans>,
|
||||||
},
|
href: getSettingsPath(SettingsPath.Workspace),
|
||||||
{
|
},
|
||||||
children: <Trans>General</Trans>,
|
{
|
||||||
href: getSettingsPath(SettingsPath.Workspace),
|
children: <Trans>General</Trans>,
|
||||||
},
|
href: getSettingsPath(SettingsPath.Workspace),
|
||||||
{ children: <Trans>Domain</Trans> },
|
},
|
||||||
]}
|
{ children: <Trans>Domain</Trans> },
|
||||||
actionButton={
|
]}
|
||||||
<SaveAndCancelButtons
|
actionButton={
|
||||||
onCancel={() => navigate(SettingsPath.Workspace)}
|
<SaveAndCancelButtons
|
||||||
isSaveDisabled={form.formState.isSubmitting}
|
onCancel={() => navigate(SettingsPath.Workspace)}
|
||||||
/>
|
isSaveDisabled={form.formState.isSubmitting}
|
||||||
}
|
/>
|
||||||
>
|
}
|
||||||
<SettingsPageContainer>
|
>
|
||||||
<SettingsSubdomain />
|
<SettingsPageContainer>
|
||||||
<SettingsCustomDomain />
|
<SettingsSubdomain />
|
||||||
</SettingsPageContainer>
|
<SettingsCustomDomain />
|
||||||
</SubMenuTopBarContainer>
|
</SettingsPageContainer>
|
||||||
<ConfirmationModal
|
</SubMenuTopBarContainer>
|
||||||
modalId={SUBDOMAIN_CHANGE_CONFIRMATION_MODAL_ID}
|
</FormProvider>
|
||||||
title={t`Change subdomain?`}
|
</form>
|
||||||
subtitle={t`You're about to change your workspace subdomain. This action will log out all users.`}
|
<ConfirmationModal
|
||||||
onConfirmClick={() => {
|
modalId={SUBDOMAIN_CHANGE_CONFIRMATION_MODAL_ID}
|
||||||
const values = form.getValues();
|
title={t`Change subdomain?`}
|
||||||
currentWorkspace &&
|
subtitle={t`You're about to change your workspace subdomain. This action will log out all users.`}
|
||||||
updateSubdomain(values.subdomain, currentWorkspace);
|
onConfirmClick={() => {
|
||||||
}}
|
const values = form.getValues();
|
||||||
/>
|
currentWorkspace &&
|
||||||
</FormProvider>
|
updateSubdomain(values.subdomain, currentWorkspace);
|
||||||
</form>
|
}}
|
||||||
|
/>
|
||||||
|
</>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user