Skip to content

Commit

Permalink
fix ts error
Browse files Browse the repository at this point in the history
  • Loading branch information
KMKoushik committed Jan 22, 2025
1 parent 88ba410 commit a070254
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions apps/web/src/server/service/campaign-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -271,8 +271,16 @@ export async function sendCampaignEmail(
// Queue emails
await Promise.all(
emails.map((email) => {
const unsubscribeUrl = createUnsubUrl(email.contactId, campaignId);
EmailQueueService.queueEmail(email.id, domain.region, false, unsubscribeUrl);
let unsubscribeUrl = undefined;
if (email.contactId) {
unsubscribeUrl = createUnsubUrl(email.contactId, campaignId);
}
EmailQueueService.queueEmail(
email.id,
domain.region,
false,
unsubscribeUrl
);
})
);
}
Expand Down

0 comments on commit a070254

Please sign in to comment.