import React, { useState } from "react"; import { useRouter } from "next/router"; import { Trash2 } from "lucide-react"; import { Dialog, Transition } from "@headlessui/react"; // hooks // ui import { Button, TOAST_TYPE, setToast } from "@plane/ui"; import { useUser } from "@/hooks/store"; type Props = { isOpen: boolean; onClose: () => void; }; export const DeactivateAccountModal: React.FC = (props) => { const router = useRouter(); const { isOpen, onClose } = props; // hooks const { deactivateAccount, signOut } = useUser(); // states const [isDeactivating, setIsDeactivating] = useState(false); const handleClose = () => { setIsDeactivating(false); onClose(); }; const handleDeleteAccount = async () => { setIsDeactivating(true); await deactivateAccount() .then(() => { setToast({ type: TOAST_TYPE.SUCCESS, title: "Success!", message: "Account deactivated successfully.", }); signOut(); router.push("/"); handleClose(); }) .catch((err: any) => setToast({ type: TOAST_TYPE.ERROR, title: "Error!", message: err?.error, }) ) .finally(() => setIsDeactivating(false)); }; return (
Deactivate your account?

Once deactivated, you can{"'"}t be assigned issues and be billed for your workspace.To reactivate your account, you will need an invite to a workspace at this email address.

); };