/* * Copyright (c) 2021 - 2023, Ludvig Lundgren and the autobrr contributors. * SPDX-License-Identifier: GPL-2.0-or-later */ import { useRef } from "react"; import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query"; import { toast } from "react-hot-toast"; import { TrashIcon } from "@heroicons/react/24/outline"; import { KeyField } from "@components/fields/text"; import { DeleteModal } from "@components/modals"; import { APIKeyAddForm } from "@forms/settings/APIKeyAddForm"; import Toast from "@components/notifications/Toast"; import { APIClient } from "@api/APIClient"; import { useToggle } from "@hooks/hooks"; import { classNames } from "@utils"; import { EmptySimple } from "@components/emptystates"; export const apiKeys = { all: ["api_keys"] as const, lists: () => [...apiKeys.all, "list"] as const, details: () => [...apiKeys.all, "detail"] as const, // detail: (id: number) => [...apiKeys.details(), id] as const detail: (id: string) => [...apiKeys.details(), id] as const }; function APISettings() { const [addFormIsOpen, toggleAddForm] = useToggle(false); const { data } = useQuery({ queryKey: apiKeys.lists(), queryFn: APIClient.apikeys.getAll, retry: false, refetchOnWindowFocus: false, onError: (err) => console.log(err) }); return (
Manage API keys.