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 React from "react"; import { toast } from "sonner"; interface Props { destinationId: string; } export const DeleteDestination = ({ destinationId }: Props) => { const { mutateAsync, isLoading } = api.destination.remove.useMutation(); const utils = api.useUtils(); return ( Are you absolutely sure? This action cannot be undone. This will permanently delete the destination Cancel { await mutateAsync({ destinationId, }) .then(() => { utils.destination.all.invalidate(); toast.success("Destination delete succesfully"); }) .catch(() => { toast.error("Error to delete destination"); }); }} > Confirm ); };