fix: edit webhook time (#18549)

This commit is contained in:
Udit Takkar
2025-01-17 08:56:50 +00:00
committed by GitHub
parent 08e58851e7
commit ea827ebbc6
2 changed files with 13 additions and 11 deletions
@@ -121,6 +121,14 @@ const WebhookForm = (props: {
},
});
const showTimeSection = formMethods
.watch("eventTriggers")
?.find(
(trigger) =>
trigger === WebhookTriggerEvents.AFTER_HOSTS_CAL_VIDEO_NO_SHOW ||
trigger === WebhookTriggerEvents.AFTER_GUESTS_CAL_VIDEO_NO_SHOW
);
const [useCustomTemplate, setUseCustomTemplate] = useState(
props?.webhook?.payloadTemplate !== undefined && props?.webhook?.payloadTemplate !== null
);
@@ -128,14 +136,6 @@ const WebhookForm = (props: {
const [changeSecret, setChangeSecret] = useState<boolean>(false);
const hasSecretKey = !!props?.webhook?.secret;
const [showTimeSection, setShowTimeSection] = useState(
!!triggerOptions.find(
(trigger) =>
trigger.value === WebhookTriggerEvents.AFTER_HOSTS_CAL_VIDEO_NO_SHOW ||
trigger.value === WebhookTriggerEvents.AFTER_GUESTS_CAL_VIDEO_NO_SHOW
)
);
useEffect(() => {
if (changeSecret) {
formMethods.unregister("secret", { keepDefaultValue: false });
@@ -219,8 +219,6 @@ const WebhookForm = (props: {
formMethods.setValue("time", undefined, { shouldDirty: true });
formMethods.setValue("timeUnit", undefined, { shouldDirty: true });
}
setShowTimeSection(noShowWebhookTriggerExists);
}}
/>
</div>
@@ -40,7 +40,11 @@ export const editHandler = async ({ input, ctx }: EditOptions) => {
where: {
id,
},
data,
data: {
...data,
time: data.time ?? null,
timeUnit: data.timeUnit ?? null,
},
});
if (data.active) {