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 { toast } from "sonner"; interface Props { portId: string; } export const DeletePort = ({ portId }: Props) => { const utils = api.useUtils(); const { mutateAsync, isLoading } = api.port.delete.useMutation(); return ( Are you absolutely sure? This action cannot be undone. This will permanently delete the port Cancel { await mutateAsync({ portId, }) .then((data) => { utils.application.one.invalidate({ applicationId: data?.applicationId, }); toast.success("Port delete succesfully"); }) .catch(() => { toast.error("Error to delete the port"); }); }} > Confirm ); };