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 { registryId: string; } export const DeleteRegistry = ({ registryId }: Props) => { const { mutateAsync, isLoading } = api.registry.remove.useMutation(); const utils = api.useUtils(); return ( Are you absolutely sure? This action cannot be undone. This will permanently delete the registry. Cancel { await mutateAsync({ registryId, }) .then(async () => { utils.registry.all.invalidate(); toast.success("Registry deleted"); }) .catch(() => { toast.error("Error to delete the registry"); }); }} > Confirm ); };