import React, { useState } from "react"; import { useRouter } from "next/router"; import { useTheme } from "next-themes"; import { mutate } from "swr"; 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 { isOpen, onClose } = props; // states const [isDeactivating, setIsDeactivating] = useState(false); const { deactivateAccount } = useUser(); const router = useRouter(); const { setTheme } = useTheme(); const handleClose = () => { setIsDeactivating(false); onClose(); }; const handleDeleteAccount = async () => { setIsDeactivating(true); await deactivateAccount() .then(() => { setToast({ type: TOAST_TYPE.SUCCESS, title: "Success!", message: "Account deactivated successfully.", }); mutate("CURRENT_USER_DETAILS", null); setTheme("system"); 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.

); };