CSR-1439 refactor navigated page storage
This commit is contained in:
parent
bfdda1fcf0
commit
c7f76b1348
2 changed files with 8 additions and 8 deletions
|
|
@ -38,7 +38,7 @@ export default {
|
||||||
additionalEventData = "_" + additionalSuccessEventDataHandler(response);
|
additionalEventData = "_" + additionalSuccessEventDataHandler(response);
|
||||||
}
|
}
|
||||||
const pageName = analyticsMixIn.methods.getPageName();
|
const pageName = analyticsMixIn.methods.getPageName();
|
||||||
const nextPageName = router.getNextPage() || pageName;
|
const nextPageName = router.lastNavigationPage || pageName;
|
||||||
analyticsMixIn.methods.pushEventToGA(
|
analyticsMixIn.methods.pushEventToGA(
|
||||||
GaCategories.API_RESPONSE,
|
GaCategories.API_RESPONSE,
|
||||||
`${nextPageName}_${endpoint}`,
|
`${nextPageName}_${endpoint}`,
|
||||||
|
|
|
||||||
|
|
@ -159,11 +159,17 @@ const router = createRouter({
|
||||||
});
|
});
|
||||||
|
|
||||||
//---------------------------------------------------------- Router Functions ----------------------------------------------------------
|
//---------------------------------------------------------- Router Functions ----------------------------------------------------------
|
||||||
|
router.beforeEach(async (to, from, next) => {
|
||||||
|
router.lastNavigationPage = to.name;
|
||||||
|
next();
|
||||||
|
});
|
||||||
|
|
||||||
router.afterEach(async (to, from) => {
|
router.afterEach(async (to, from) => {
|
||||||
// Update lastPageVisited in the store
|
// Update lastPageVisited in the store
|
||||||
store.commit(storeMutations.UPDATE_LAST_PAGE_VISITED, to.name);
|
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 saving on navigation is requested, check for saved SessionId or EmailAddress to determine if saving is appropriate
|
||||||
if (eval(to.params.isSavingNavigation)) {
|
if (eval(to.params.isSavingNavigation)) {
|
||||||
if (
|
if (
|
||||||
|
|
@ -226,12 +232,6 @@ router.overrideNavigation = (
|
||||||
next();
|
next();
|
||||||
};
|
};
|
||||||
|
|
||||||
router.getNextPage = () => nextPageName;
|
|
||||||
|
|
||||||
// PRIVATE VARIABLES
|
|
||||||
|
|
||||||
var nextPageName;
|
|
||||||
|
|
||||||
// PRIVATE FUNCTIONS
|
// PRIVATE FUNCTIONS
|
||||||
|
|
||||||
// Navigate to the next route, depending on the scenario.
|
// Navigate to the next route, depending on the scenario.
|
||||||
|
|
@ -255,7 +255,7 @@ async function navigate(
|
||||||
if (destinationFmgPageValue !== undefined) {
|
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.
|
// 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
|
// 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);
|
const existingPageDataForPage = store.getters.pageData(destinationFmgPageValue);
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue