diff --git a/src/server.ts b/src/server.ts index 5cdd626..9e7aea1 100644 --- a/src/server.ts +++ b/src/server.ts @@ -299,16 +299,22 @@ addRoute('post', '/notify/:id', async (req: Request, res: Response) => { } }) +// ── Branding helper ────────────────────────────────────────────────────── + +const brandingVars = () => ({ + brandName: BRAND_NAME, + brandAccent: BRAND_ACCENT, + brandLogo: BRAND_LOGO, + settingsUrl: `${EVENT_VIEWER_URL}/settings/alerts`, +}) + // Confirmation addRoute('get', '/confirm', async (req: Request, res: Response) => { if (typeof req.query.token !== 'string') { return res.send( await render('pages/confirm-error.html', { message: 'No confirmation token was provided. Please check the link in your email and try again.', - brandName: BRAND_NAME, - brandAccent: BRAND_ACCENT, - brandLogo: BRAND_LOGO, - settingsUrl: `${EVENT_VIEWER_URL}/settings/alerts`, + ...brandingVars(), }) ) } @@ -317,10 +323,7 @@ addRoute('get', '/confirm', async (req: Request, res: Response) => { await confirmSubscriptionAction({ token: req.query.token }) res.send(await render('pages/confirm-success.html', { - brandName: BRAND_NAME, - brandAccent: BRAND_ACCENT, - brandLogo: BRAND_LOGO, - settingsUrl: `${EVENT_VIEWER_URL}/settings/alerts`, + ...brandingVars(), })) } catch (error) { const isActionError = error instanceof ActionError @@ -328,10 +331,7 @@ addRoute('get', '/confirm', async (req: Request, res: Response) => { res.send(await render('pages/confirm-error.html', { message, - brandName: BRAND_NAME, - brandAccent: BRAND_ACCENT, - brandLogo: BRAND_LOGO, - settingsUrl: `${EVENT_VIEWER_URL}/settings/alerts`, + ...brandingVars(), })) if (!isActionError) {