update: webhooks

This commit is contained in:
anik-ghosh-au7 2022-07-15 13:17:09 +05:30
parent 41a0f15e16
commit eabc943452

View File

@ -206,7 +206,10 @@ const AddWebhookModal = () => {
if (!validateData()) return;
setLoading(true);
let { [INPUT_FIELDS.HEADERS]: _, ...params }: any = webhook;
if (webhook[INPUT_FIELDS.HEADERS].length > 0) {
if (
webhook[INPUT_FIELDS.HEADERS].length > 0 &&
webhook[INPUT_FIELDS.HEADERS][0][HEADER_FIELDS.KEY]
) {
const headers = webhook[INPUT_FIELDS.HEADERS].reduce((acc, data) => {
return { ...acc, [data.key]: data.value };
}, {});