Merge pull request #58 from xtr-dev/dev

Dev
This commit is contained in:
Bas
2025-09-20 20:18:56 +02:00
committed by GitHub
2 changed files with 3 additions and 4 deletions

View File

@@ -1,6 +1,6 @@
{
"name": "@xtr-dev/payload-mailing",
"version": "0.4.10",
"version": "0.4.11",
"description": "Template-based email system with scheduling and job processing for PayloadCMS",
"type": "module",
"main": "dist/index.js",

View File

@@ -182,9 +182,8 @@ export const sendEmail = async <TEmail extends BaseEmailDocument = BaseEmailDocu
if (emailWithJobs.jobs && emailWithJobs.jobs.length > 0) {
// Job found! Get the first job ID (should only be one for a new email)
jobId = Array.isArray(emailWithJobs.jobs)
? String(emailWithJobs.jobs[0])
: String(emailWithJobs.jobs)
const firstJob = Array.isArray(emailWithJobs.jobs) ? emailWithJobs.jobs[0] : emailWithJobs.jobs
jobId = typeof firstJob === 'string' ? firstJob : String(firstJob.id || firstJob)
logger.info(`Found job ID: ${jobId}`)
break
}