aboutsummaryrefslogtreecommitdiffstats
path: root/packages/web/app/dashboard/settings/components/DeleteApiKey.tsx
diff options
context:
space:
mode:
authorMohamedBassem <me@mbassem.com>2024-03-10 17:59:58 +0000
committerMohamedBassem <me@mbassem.com>2024-03-10 17:59:58 +0000
commitd6dd76021226802adf5295b3243d6f2ae4fa5cc2 (patch)
tree7a25423d46db9e0e224b5f58b73cec5768953b44 /packages/web/app/dashboard/settings/components/DeleteApiKey.tsx
parent8ab868d3f94cc6609d278dc952432f1a244c3f84 (diff)
downloadkarakeep-d6dd76021226802adf5295b3243d6f2ae4fa5cc2.tar.zst
refactor: Move all components to the top level directory
Diffstat (limited to 'packages/web/app/dashboard/settings/components/DeleteApiKey.tsx')
-rw-r--r--packages/web/app/dashboard/settings/components/DeleteApiKey.tsx74
1 files changed, 0 insertions, 74 deletions
diff --git a/packages/web/app/dashboard/settings/components/DeleteApiKey.tsx b/packages/web/app/dashboard/settings/components/DeleteApiKey.tsx
deleted file mode 100644
index 566136af..00000000
--- a/packages/web/app/dashboard/settings/components/DeleteApiKey.tsx
+++ /dev/null
@@ -1,74 +0,0 @@
-"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 { useRouter } from "next/navigation";
-import { toast } from "@/components/ui/use-toast";
-import { api } from "@/lib/trpc";
-import { ActionButton } from "@/components/ui/action-button";
-import { useState } from "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 (
- <Dialog open={isDialogOpen} onOpenChange={setDialogOpen}>
- <DialogTrigger asChild>
- <Button variant="destructive">
- <Trash className="size-5" />
- </Button>
- </DialogTrigger>
- <DialogContent>
- <DialogHeader>
- <DialogTitle>Delete API Key</DialogTitle>
- <DialogDescription>
- Are you sure you want to delete the API key &quot;{name}&quot;? Any
- service using this API key will lose access.
- </DialogDescription>
- </DialogHeader>
- <DialogFooter className="sm:justify-end">
- <DialogClose asChild>
- <Button type="button" variant="secondary">
- Close
- </Button>
- </DialogClose>
- <ActionButton
- type="button"
- variant="destructive"
- loading={mutator.isPending}
- onClick={() => mutator.mutate({ id })}
- >
- Delete
- </ActionButton>
- </DialogFooter>
- </DialogContent>
- </Dialog>
- );
-}