From 6a924eaba8ef3a39d6d778f228f9a9dc009ce45e Mon Sep 17 00:00:00 2001 From: Akinsola Lawanson <106528085+akinsola-guardian@users.noreply.github.com> Date: Mon, 9 Sep 2024 13:26:31 +0100 Subject: [PATCH] Passing query params (ref, refViewId) to subscribe/success (#2877) * Passing query params (ref, refViewId) to subscribe/success * Use res.locals.queryParams instead of res.query --- src/server/routes/consentToken.ts | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/server/routes/consentToken.ts b/src/server/routes/consentToken.ts index 17539fc31..e0849619e 100644 --- a/src/server/routes/consentToken.ts +++ b/src/server/routes/consentToken.ts @@ -10,7 +10,7 @@ import { import { mergeRequestState } from '@/server/lib/requestState'; import { logger } from '@/server/lib/serverSideLogger'; import { trackMetric } from '@/server/lib/trackMetric'; -import { buildUrl } from '@/shared/lib/routeUtils'; +import { buildUrlWithQueryParams } from '@/shared/lib/routeUtils'; // When a user attempts to sign up for newsletters, rather than immediately signing them up, // we may instead call the IDAPI endpoint /consent-email to send them an email with a link @@ -26,7 +26,14 @@ router.get( trackMetric('ConsentToken::Success'); - return res.redirect(303, buildUrl('/subscribe/success')); + return res.redirect( + 303, + buildUrlWithQueryParams( + '/subscribe/success', + {}, + res.locals.queryParams, + ), + ); } catch (error) { logger.error(`${req.method} ${req.originalUrl} Error`, error, { request_id: res.locals.requestId,