import { TrashIcon, PencilAltIcon } from "@heroicons/react/outline"; import { useLocale } from "@lib/hooks/useLocale"; import showToast from "@lib/notification"; import { Webhook } from "@lib/webhook"; import { Dialog, DialogTrigger } from "@components/Dialog"; import { Tooltip } from "@components/Tooltip"; import ConfirmationDialogContent from "@components/dialog/ConfirmationDialogContent"; import Button from "@components/ui/Button"; export default function WebhookListItem(props: { onChange: () => void; key: string; webhook: Webhook; onEditWebhook: () => void; }) { const { t } = useLocale(); const handleErrors = async (resp: Response) => { if (!resp.ok) { const err = await resp.json(); throw new Error(err.message); } return resp.json(); }; const deleteWebhook = (webhookId: string) => { fetch("/api/webhooks/" + webhookId, { method: "DELETE", headers: { "Content-Type": "application/json", }, }) .then(handleErrors) .then(() => { showToast(t("webhook_removed_successfully"), "success"); props.onChange(); }); }; return (