From 6aacc0c7a86e36c52a3c2c1d26fe58cefcd3bec4 Mon Sep 17 00:00:00 2001 From: MohamedBassem Date: Mon, 12 Feb 2024 14:52:00 +0000 Subject: feature: Add support for managing API keys --- .../dashboard/settings/components/DeleteApiKey.tsx | 65 ++++++++++++++++++++++ 1 file changed, 65 insertions(+) create mode 100644 packages/web/app/dashboard/settings/components/DeleteApiKey.tsx (limited to 'packages/web/app/dashboard/settings/components/DeleteApiKey.tsx') diff --git a/packages/web/app/dashboard/settings/components/DeleteApiKey.tsx b/packages/web/app/dashboard/settings/components/DeleteApiKey.tsx new file mode 100644 index 00000000..715b7a2c --- /dev/null +++ b/packages/web/app/dashboard/settings/components/DeleteApiKey.tsx @@ -0,0 +1,65 @@ +"use client"; + +import { Button } from "@/components/ui/button"; +import { Trash } from "lucide-react"; + +import { + Dialog, + DialogClose, + DialogContent, + DialogDescription, + DialogFooter, + DialogHeader, + DialogTitle, + DialogTrigger, +} from "@/components/ui/dialog"; +import { api } from "@/lib/trpc"; +import { useRouter } from "next/navigation"; +import { toast } from "@/components/ui/use-toast"; + +export default function DeleteApiKey({ + name, + id, +}: { + name: string; + id: string; +}) { + const router = useRouter(); + const deleteKey = async () => { + await api.apiKeys.revoke.mutate({ id }); + toast({ + description: "Key was successfully deleted", + }); + 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. + + + + + + + + + + + + + ); +} -- cgit v1.2.3-70-g09d2