mirror of
https://github.com/graphql-hive/console
synced 2026-05-23 09:08:34 +00:00
fix: deletion of organization results in error (#4144)
This commit is contained in:
parent
c2cd0d9b93
commit
aa52c1b613
1 changed files with 2 additions and 7 deletions
|
|
@ -2,7 +2,7 @@ import { ReactElement } from 'react';
|
|||
import { useRouter } from 'next/router';
|
||||
import { useMutation } from 'urql';
|
||||
import { Button, Heading, Modal } from '@/components/v2';
|
||||
import { FragmentType, graphql, useFragment } from '@/gql';
|
||||
import { FragmentType, graphql } from '@/gql';
|
||||
import { useRouteSelector } from '@/lib/hooks';
|
||||
import { TrashIcon } from '@radix-ui/react-icons';
|
||||
|
||||
|
|
@ -29,16 +29,11 @@ const DeleteOrganizationModal_OrganizationFragment = graphql(`
|
|||
export const DeleteOrganizationModal = ({
|
||||
isOpen,
|
||||
toggleModalOpen,
|
||||
...props
|
||||
}: {
|
||||
isOpen: boolean;
|
||||
toggleModalOpen: () => void;
|
||||
organization: FragmentType<typeof DeleteOrganizationModal_OrganizationFragment>;
|
||||
}): ReactElement => {
|
||||
const organization = useFragment(
|
||||
DeleteOrganizationModal_OrganizationFragment,
|
||||
props.organization,
|
||||
);
|
||||
const [, mutate] = useMutation(DeleteOrganizationDocument);
|
||||
const router = useRouteSelector();
|
||||
const { replace } = useRouter();
|
||||
|
|
@ -69,8 +64,8 @@ export const DeleteOrganizationModal = ({
|
|||
organization: router.organizationId,
|
||||
},
|
||||
});
|
||||
void (await replace('/'));
|
||||
toggleModalOpen();
|
||||
void replace(`/${organization.cleanId}`);
|
||||
}}
|
||||
>
|
||||
Delete
|
||||
|
|
|
|||
Loading…
Reference in a new issue