fix(outbound): guard optional delivery fields
This commit is contained in:
@@ -56,10 +56,18 @@ export function buildOutboundDeliveryJson(params: {
|
|||||||
mediaUrl: params.mediaUrl ?? null,
|
mediaUrl: params.mediaUrl ?? null,
|
||||||
};
|
};
|
||||||
|
|
||||||
if (result?.chatId !== undefined) payload.chatId = result.chatId;
|
if (result && "chatId" in result && result.chatId !== undefined) {
|
||||||
if (result?.channelId !== undefined) payload.channelId = result.channelId;
|
payload.chatId = result.chatId;
|
||||||
if (result?.timestamp !== undefined) payload.timestamp = result.timestamp;
|
}
|
||||||
if (result?.toJid !== undefined) payload.toJid = result.toJid;
|
if (result && "channelId" in result && result.channelId !== undefined) {
|
||||||
|
payload.channelId = result.channelId;
|
||||||
|
}
|
||||||
|
if (result && "timestamp" in result && result.timestamp !== undefined) {
|
||||||
|
payload.timestamp = result.timestamp;
|
||||||
|
}
|
||||||
|
if (result && "toJid" in result && result.toJid !== undefined) {
|
||||||
|
payload.toJid = result.toJid;
|
||||||
|
}
|
||||||
|
|
||||||
return payload;
|
return payload;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user