CSR-1439 refactor navigated page storage

This commit is contained in:
Matt Caimi 2023-06-23 13:09:30 -04:00
parent bfdda1fcf0
commit c7f76b1348
2 changed files with 8 additions and 8 deletions

View file

@ -38,7 +38,7 @@ export default {
additionalEventData = "_" + additionalSuccessEventDataHandler(response);
}
const pageName = analyticsMixIn.methods.getPageName();
const nextPageName = router.getNextPage() || pageName;
const nextPageName = router.lastNavigationPage || pageName;
analyticsMixIn.methods.pushEventToGA(
GaCategories.API_RESPONSE,
`${nextPageName}_${endpoint}`,

View file

@ -159,11 +159,17 @@ const router = createRouter({
});
//---------------------------------------------------------- Router Functions ----------------------------------------------------------
router.beforeEach(async (to, from, next) => {
router.lastNavigationPage = to.name;
next();
});
router.afterEach(async (to, from) => {
// Update lastPageVisited in the store
store.commit(storeMutations.UPDATE_LAST_PAGE_VISITED, to.name);
// router.lastNavigationPage = to.name;
// If saving on navigation is requested, check for saved SessionId or EmailAddress to determine if saving is appropriate
if (eval(to.params.isSavingNavigation)) {
if (
@ -226,12 +232,6 @@ router.overrideNavigation = (
next();
};
router.getNextPage = () => nextPageName;
// PRIVATE VARIABLES
var nextPageName;
// PRIVATE FUNCTIONS
// Navigate to the next route, depending on the scenario.
@ -255,7 +255,7 @@ async function navigate(
if (destinationFmgPageValue !== undefined) {
// We're always pushing the same path, just changing query strings. Make sure our optional query strings get combined with our fmgPage one.
nextPageName = destinationFmgPageValue;
// router.lastNavigationPage = destinationFmgPageValue;
// Update page data to the store for next page if provided. Otherwise, keep existing page data or set to empty object
const existingPageDataForPage = store.getters.pageData(destinationFmgPageValue);