fix: possibly undefined newsletter com

This commit is contained in:
Julian Krauser 2025-01-10 11:26:48 +01:00
parent 55d4a952c3
commit c173f917e3

View file

@ -227,14 +227,14 @@ export async function getCommunicationByMemberAndRecord(req: Request, res: Respo
* @returns {Promise<*>} * @returns {Promise<*>}
*/ */
export async function createMemberPrintoutList(req: Request, res: Response): Promise<any> { export async function createMemberPrintoutList(req: Request, res: Response): Promise<any> {
let members = await MemberService.getByRunningMembership() let members = await MemberService.getByRunningMembership();
let pdf = await PdfExport.renderFile({ let pdf = await PdfExport.renderFile({
title: "Mitgliederliste", title: "Mitgliederliste",
template: "member.list", template: "member.list",
saveToDisk: false, saveToDisk: false,
data: { data: {
member: members member: members,
}, },
}); });
@ -596,7 +596,7 @@ export async function updateCommunicationOfMember(req: Request, res: Response):
communicationId: recordId, communicationId: recordId,
}; };
await MemberCommandHandler.updateNewsletter(updateNewsletter); await MemberCommandHandler.updateNewsletter(updateNewsletter);
} else if (currentUserNewsletterMain.sendNewsletter.id == recordId) { } else if (currentUserNewsletterMain.sendNewsletter?.id == recordId) {
await MemberCommandHandler.unsetNewsletter(memberId); await MemberCommandHandler.unsetNewsletter(memberId);
} }