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
|
// Confirmation
|
||||||
addRoute('get', '/confirm', async (req: Request, res: Response) => {
|
addRoute('get', '/confirm', async (req: Request, res: Response) => {
|
||||||
if (typeof req.query.token !== 'string') {
|
if (typeof req.query.token !== 'string') {
|
||||||
return res.send(
|
return res.send(
|
||||||
await render('pages/confirm-error.html', {
|
await render('pages/confirm-error.html', {
|
||||||
message: 'No confirmation token was provided. Please check the link in your email and try again.',
|
message: 'No confirmation token was provided. Please check the link in your email and try again.',
|
||||||
brandName: BRAND_NAME,
|
...brandingVars(),
|
||||||
brandAccent: BRAND_ACCENT,
|
|
||||||
brandLogo: BRAND_LOGO,
|
|
||||||
settingsUrl: `${EVENT_VIEWER_URL}/settings/alerts`,
|
|
||||||
})
|
})
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
@ -317,10 +323,7 @@ addRoute('get', '/confirm', async (req: Request, res: Response) => {
|
||||||
await confirmSubscriptionAction({ token: req.query.token })
|
await confirmSubscriptionAction({ token: req.query.token })
|
||||||
|
|
||||||
res.send(await render('pages/confirm-success.html', {
|
res.send(await render('pages/confirm-success.html', {
|
||||||
brandName: BRAND_NAME,
|
...brandingVars(),
|
||||||
brandAccent: BRAND_ACCENT,
|
|
||||||
brandLogo: BRAND_LOGO,
|
|
||||||
settingsUrl: `${EVENT_VIEWER_URL}/settings/alerts`,
|
|
||||||
}))
|
}))
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
const isActionError = error instanceof ActionError
|
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', {
|
res.send(await render('pages/confirm-error.html', {
|
||||||
message,
|
message,
|
||||||
brandName: BRAND_NAME,
|
...brandingVars(),
|
||||||
brandAccent: BRAND_ACCENT,
|
|
||||||
brandLogo: BRAND_LOGO,
|
|
||||||
settingsUrl: `${EVENT_VIEWER_URL}/settings/alerts`,
|
|
||||||
}))
|
}))
|
||||||
|
|
||||||
if (!isActionError) {
|
if (!isActionError) {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue