Skip to content

Commit

Permalink
Passing query params (ref, refViewId) to subscribe/success (#2877)
Browse files Browse the repository at this point in the history
* Passing query params (ref, refViewId) to subscribe/success

* Use res.locals.queryParams instead of res.query
  • Loading branch information
akinsola-guardian authored Sep 9, 2024
1 parent 7b4c02b commit 6a924ea
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/server/routes/consentToken.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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,
Expand Down

0 comments on commit 6a924ea

Please sign in to comment.