import { Modal, Text, Button, Group, Stack } from "@mantine/core"; import { useTranslation } from "react-i18next"; import { useRevokeApiKeyMutation } from "@/ee/api-key/queries/api-key-query.ts"; import { IApiKey } from "@/ee/api-key"; interface RevokeApiKeyModalProps { opened: boolean; onClose: () => void; apiKey: IApiKey | null; } export function RevokeApiKeyModal({ opened, onClose, apiKey, }: RevokeApiKeyModalProps) { const { t } = useTranslation(); const revokeApiKeyMutation = useRevokeApiKeyMutation(); const handleRevoke = async () => { if (!apiKey) return; await revokeApiKeyMutation.mutateAsync({ apiKeyId: apiKey.id, }); onClose(); }; return ( {t("Are you sure you want to revoke this {{credential}}", { credential: t("API key"), })}{" "} {apiKey?.name}? {t( "This action cannot be undone. Any applications using this API key will stop working.", )} ); }