Skip to content

Commit

Permalink
refactor: simplify code and change ticket "Siège" -> "Place"
Browse files Browse the repository at this point in the history
  • Loading branch information
Antoine D committed Dec 4, 2024
1 parent 91cff70 commit 5d7f19a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
6 changes: 2 additions & 4 deletions src/services/email/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -138,8 +138,7 @@ export const sendMailsFromTemplate = async (template: string, targets: any[]) =>
if (targets.length > 1) {
const outgoingMails = await Promise.allSettled(
targets.map(async (target) => {
const mail = await mailTemplate(target);
await sendEmail(mail);
await sendEmail(await mailTemplate(target));
}),
);

Expand All @@ -163,8 +162,7 @@ export const sendMailsFromTemplate = async (template: string, targets: any[]) =>
console.info(`\tMails envoyés: ${results.delivered}\n\tMails non envoyés: ${results.undelivered}`);
return results;
}
const mail = await mailTemplate(targets[0]);
return sendEmail(mail);
return sendEmail(await mailTemplate(targets[0]));
} catch (error) {
logger.error('Error while sending emails', error);
return false;
Expand Down
2 changes: 1 addition & 1 deletion src/utils/ticket.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ export const generateTicket = async (cartItem: DetailedCartItem): Promise<EmailA

// Place the text containing the seat
if (user.place) {
const place = `Siège ${user.place}`;
const place = `Place ${user.place}`;
const placeWidth = document.widthOfString(place);
textFormat.text(place, textX - placeWidth / 2, height - fontSize - lineSpaceCorrection * 4);
}
Expand Down

0 comments on commit 5d7f19a

Please sign in to comment.