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