diff --git a/frontend/src/pages/organization/SettingsPage/components/OrgDeleteSection/OrgDeleteSection.tsx b/frontend/src/pages/organization/SettingsPage/components/OrgDeleteSection/OrgDeleteSection.tsx index 9cd59c0ad..bb2e9ea4d 100644 --- a/frontend/src/pages/organization/SettingsPage/components/OrgDeleteSection/OrgDeleteSection.tsx +++ b/frontend/src/pages/organization/SettingsPage/components/OrgDeleteSection/OrgDeleteSection.tsx @@ -4,8 +4,8 @@ import { createNotification } from "@app/components/notifications"; import { Button, DeleteActionModal } from "@app/components/v2"; import { useOrganization, useOrgPermission } from "@app/context"; import { useDeleteOrgById } from "@app/hooks/api"; +import { clearSession } from "@app/hooks/api/users/queries"; import { usePopUp } from "@app/hooks/usePopUp"; -import { navigateUserToOrg } from "@app/pages/auth/LoginPage/Login.utils"; export const OrgDeleteSection = () => { const navigate = useNavigate(); @@ -13,9 +13,7 @@ export const OrgDeleteSection = () => { const { membership } = useOrgPermission(); - const { popUp, handlePopUpOpen, handlePopUpClose, handlePopUpToggle } = usePopUp([ - "deleteOrg" - ] as const); + const { popUp, handlePopUpOpen, handlePopUpToggle } = usePopUp(["deleteOrg"] as const); const { mutateAsync, isPending } = useDeleteOrgById(); @@ -32,9 +30,8 @@ export const OrgDeleteSection = () => { type: "success" }); - await navigateUserToOrg(navigate); - - handlePopUpClose("deleteOrg"); + clearSession(); + navigate({ to: "/login" }); } catch (err) { console.error(err); createNotification({