// react import React, { useState } from "react"; // next import { useRouter } from "next/router"; // components import { Button } from "@plane/ui"; // hooks import useToast from "hooks/use-toast"; // services import { AuthService } from "services/auth.service"; // headless ui import { Dialog, Transition } from "@headlessui/react"; // icons import { AlertTriangle } from "lucide-react"; import { UserService } from "services/user.service"; type Props = { isOpen: boolean; onClose: () => void; }; const authService = new AuthService(); const userService = new UserService(); const DeleteAccountModal: React.FC = (props) => { const { isOpen, onClose } = props; const [isDeleteLoading, setIsDeleteLoading] = useState(false); const router = useRouter(); const { setToastAlert } = useToast(); const handleSignOut = async () => { await authService .signOut() .then(() => { router.push("/"); }) .catch(() => setToastAlert({ type: "error", title: "Error!", message: "Failed to sign out. Please try again.", }) ); }; const handleDeleteAccount = async () => { setIsDeleteLoading(true); await userService .deleteAccount() .then(() => { setToastAlert({ type: "success", title: "Success!", message: "Account deleted successfully.", }); router.push("/"); }) .catch((err) => setToastAlert({ type: "error", title: "Error!", message: err?.data?.error, }) ); setIsDeleteLoading(false); }; const handleClose = () => { onClose(); }; return (
Not the right workspace?
  • Delete this account if you have another and won’t use this account.
  • Switch to another account if you’d like to come back to this account another time.
Switch account
); }; export default DeleteAccountModal;