diff --git a/prime-angular-frontend/src/app/modules/enrolment/pages/next-steps/next-steps.component.ts b/prime-angular-frontend/src/app/modules/enrolment/pages/next-steps/next-steps.component.ts index bba310e82e..d72283e017 100644 --- a/prime-angular-frontend/src/app/modules/enrolment/pages/next-steps/next-steps.component.ts +++ b/prime-angular-frontend/src/app/modules/enrolment/pages/next-steps/next-steps.component.ts @@ -199,7 +199,7 @@ export class NextStepsComponent extends BaseEnrolmentProfilePage implements OnIn let emailPairs = this.careSettingConfigs.map((config) => { return { - emails: config.formArray.value.map(email => email.email), + emails: config.formArray.value.map(email => email.email).filter(e => e), careSettingCode: config.settingCode, healthAuthorityCode: config.settingCode === CareSettingEnum.HEALTH_AUTHORITY ? config.healthAuthorityCode : null, } diff --git a/prime-angular-frontend/src/app/modules/enrolment/pages/pharmanet-enrolment-summary/pharmanet-enrolment-summary.component.ts b/prime-angular-frontend/src/app/modules/enrolment/pages/pharmanet-enrolment-summary/pharmanet-enrolment-summary.component.ts index 2df55efb94..d5da825a07 100644 --- a/prime-angular-frontend/src/app/modules/enrolment/pages/pharmanet-enrolment-summary/pharmanet-enrolment-summary.component.ts +++ b/prime-angular-frontend/src/app/modules/enrolment/pages/pharmanet-enrolment-summary/pharmanet-enrolment-summary.component.ts @@ -213,7 +213,7 @@ export class PharmanetEnrolmentSummaryComponent extends BaseEnrolmentPage implem if (result) { let emailPairs = this.careSettingConfigs.map((config) => { return { - emails: config.formArray.value.map(email => email.email), + emails: config.formArray.value.map(email => email.email).filter(e => e), careSettingCode: config.settingCode, healthAuthorityCode: config.healthAuthorityCode, } @@ -227,8 +227,8 @@ export class PharmanetEnrolmentSummaryComponent extends BaseEnrolmentPage implem .subscribe(() => { let emails = new Array(); this.careSettingConfigs.forEach((config) => { - if (config.formArray.value[0].email) { - emails.push(config.formArray.value.map(email => email.email)); + if (config.formArray.value.map(email => email.email).filter(e => e)[0]) { + emails.push(config.formArray.value.map(email => email.email).filter(e => e)); } }); this.toastService.openSuccessToast(`Email was successfully sent to ${emails.join(", ")}`);