import { EntityWebhook } from "@toolctrl/db/prisma-browser"; import { useState } from "react"; import { useTranslation } from "react-i18next"; import { DefaultLogActions } from "~/application/dtos/shared/DefaultLogActions"; import FormGroup from "~/components/ui/forms/FormGroup"; import InputSelect from "~/components/ui/input/InputSelect"; import InputText from "~/components/ui/input/InputText"; interface Props { item?: EntityWebhook; } export default function EntityWebhookForm({ item }: Props) { const { t } = useTranslation(); const [action, setAction] = useState(item?.action ?? "Created"); const [method, setMethod] = useState(item?.method ?? "POST"); const [endpoint, setEndpoint] = useState(item?.endpoint ?? ""); return ( {/* */} setAction(e?.toString() ?? "")} options={[ { name: t("models.entityWebhook.actions.created"), value: DefaultLogActions.Created, }, { name: t("models.entityWebhook.actions.updated"), value: DefaultLogActions.Updated, }, { name: t("models.entityWebhook.actions.deleted"), value: DefaultLogActions.Deleted, }, ]} required /> setMethod(e?.toString() ?? "")} options={[ { name: "POST", value: "POST", }, { name: "GET", value: "GET", disabled: true, }, ]} required /> ); }