Merge pull request #3589 from Infisical/misc/updated-org-delete-flow

misc: updated org delete flow to clear session
This commit is contained in:
Maidul Islam
2025-05-13 11:41:09 -04:00
committed by GitHub

View File

@@ -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({