"use client"; import { useState } from "react"; import { useRouter } from "next/navigation"; import { ActionButton } from "@/components/ui/action-button"; import { Button } from "@/components/ui/button"; import { Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTitle, DialogTrigger, } from "@/components/ui/dialog"; import { toast } from "@/components/ui/use-toast"; import { api } from "@/lib/trpc"; import { Trash } from "lucide-react"; export default function DeleteApiKey({ name, id, }: { name: string; id: string; }) { const [isDialogOpen, setDialogOpen] = useState(false); const router = useRouter(); const mutator = api.apiKeys.revoke.useMutation({ onSuccess: () => { toast({ description: "Key was successfully deleted", }); setDialogOpen(false); router.refresh(); }, }); return ( Delete API Key Are you sure you want to delete the API key "{name}"? Any service using this API key will lose access. mutator.mutate({ id })} > Delete ); }