Skip to content

Commit

Permalink
refactor: supprime emailPromise
Browse files Browse the repository at this point in the history
  • Loading branch information
Shamzic committed Nov 21, 2023
1 parent 4eb100f commit f402fb2
Showing 1 changed file with 3 additions and 11 deletions.
14 changes: 3 additions & 11 deletions backend/lib/messaging/sending.ts
Original file line number Diff line number Diff line change
Expand Up @@ -115,30 +115,22 @@ async function processSingleEmail(emailType: EmailType, followupId: string) {
throw new Error("Followup not found")
}

let emailPromise: Survey | Followup

switch (emailType) {
case EmailType.SimulationResults:
emailPromise = await sendSimulationResultsEmail(followup)
sendSimulationResultsEmail(followup)
break
case EmailType.BenefitAction:
emailPromise = await sendSurveyEmail(
followup,
SurveyType.TrackClickOnBenefitActionEmail
)
await sendSurveyEmail(followup, SurveyType.TrackClickOnBenefitActionEmail)
break
case EmailType.SimulationUsefulness:
emailPromise = await sendSurveyEmail(
await sendSurveyEmail(
followup,
SurveyType.TrackClickOnSimulationUsefulnessEmail
)
break
default:
throw new Error(`Unknown email type: ${emailType}`)
}

const email = await emailPromise
console.log("Email sent", email)
}

export async function processSendEmails(
Expand Down

0 comments on commit f402fb2

Please sign in to comment.