import { useWatch } from "react-hook-form"; import { useLocale } from "@calcom/lib/hooks/useLocale"; import { trpc } from "@calcom/trpc/react"; import { Badge, Button, Icon, showToast } from "@calcom/ui"; export default function WebhookTestDisclosure() { const subscriberUrl: string = useWatch({ name: "subscriberUrl" }); const payloadTemplate = useWatch({ name: "payloadTemplate" }) || null; const { t } = useLocale(); const mutation = trpc.viewer.webhook.testTrigger.useMutation({ onError(err) { showToast(err.message, "error"); }, }); return (

{t("webhook_response")}

{mutation.data && ( {mutation.data.ok ? t("passed") : t("failed")} )}
{!mutation.data && {t("no_data_yet")}} {mutation.status === "success" && (
{JSON.stringify(mutation.data, null, 4)}
)}
); }