import { AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogTitle, AlertDialogTrigger, } from "@/components/ui/alert-dialog"; import { Button } from "@/components/ui/button"; import { api } from "@/utils/api"; import { TrashIcon } from "lucide-react"; import { useRouter } from "next/router"; import { toast } from "sonner"; interface Props { postgresId: string; } export const DeletePostgres = ({ postgresId }: Props) => { const { mutateAsync, isLoading } = api.postgres.remove.useMutation(); const { push } = useRouter(); return ( Are you absolutely sure? This action cannot be undone. This will permanently delete the database Cancel { await mutateAsync({ postgresId, }) .then((data) => { push(`/dashboard/project/${data?.projectId}`); toast.success("Database delete succesfully"); }) .catch(() => { toast.error("Error to delete the database"); }); }} > Confirm ); };