Merge pull request 'Extract shared brandingVars() helper to eliminate duplication' (#17) from mailship-90c-extract-shared-brandingvars-helper-brand-e34 into main
All checks were successful
CI / checks (push) Successful in 36s
All checks were successful
CI / checks (push) Successful in 36s
Reviewed-on: #17 Reviewed-by: matt <matt@lorentz.is>
This commit is contained in:
commit
2ee4e53bd9
1 changed files with 12 additions and 12 deletions
|
|
@ -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) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue