diff --git a/src/helpers/querystring-helper.js b/src/helpers/querystring-helper.js index 38583b1ae..8c40c91b7 100644 --- a/src/helpers/querystring-helper.js +++ b/src/helpers/querystring-helper.js @@ -8,3 +8,17 @@ export function getQuerystringParameter(key) { return lowerCaseParams.get(key) ? lowerCaseParams.get(key) : null; } + +// if you add the fmgPage to the querystringobject before calling, then pass true for skipFmgPageName +export function buildQuerystringObject(qso, skipFmgPageName=false) { + const queryString = window.location.search; + const urlParams = new URLSearchParams(queryString); + + for (const [name, value] of urlParams) { + if (name.toLowerCase() === "fmgpage" && skipFmgPageName) { + continue; + } + qso[name] = value; + } + return qso; +} \ No newline at end of file diff --git a/src/router/index.js b/src/router/index.js index d956af773..73a8545f3 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -6,7 +6,7 @@ import { lazyLoadComponent } from "@/router/dynamic-routing/component-loader.js" import { routingTable } from "@/router/router-constants/routing-table.js"; import { globalEvents, globalEventTypes } from "@/constants/events"; import { queryStrings } from "@/constants/query-strings"; -import { getQuerystringParameter } from "@/helpers/querystring-helper"; +import { getQuerystringParameter, buildQuerystringObject } from "@/helpers/querystring-helper"; import { getDeviceIdValue } from "@/helpers/heritage-integration/cookie-helper"; import { showFmgLoadingModal } from "@/helpers/loading-modal-helper"; import { fmgPageValues, funnelStartPageName } from "@/router/router-constants/fmgPage-values"; @@ -108,14 +108,13 @@ const routes = [ var qso = { fmgPage: fmgPageValues.RETURN_USER, }; - const lg = getQuerystringParameter(queryStrings.LOG); - if (lg) { - qso[queryStrings.LOG] = true; - } + + const newQueryString = buildQuerystringObject(qso, true); + log(" -- returnUser add querystring: " + JSON.stringify(newQueryString)); router.push({ path: "/", - query: Object.assign({}, qso), + query: Object.assign({}, newQueryString), }); return; }