From 243cc0406f1584e26ecc33d143e4e670d15eac74 Mon Sep 17 00:00:00 2001 From: Jason Wheeler Date: Mon, 19 Sep 2022 15:52:44 -0400 Subject: [PATCH 1/3] Updated router to handle root navigation and began to reference iss-page-values --- src/router/index.js | 23 ++++++++++++++----- src/router/router-constants/issPage-values.js | 8 ++++--- src/router/router-constants/routing-table.js | 15 +++++++++--- 3 files changed, 34 insertions(+), 12 deletions(-) diff --git a/src/router/index.js b/src/router/index.js index c3cddaf1..10919978 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -3,16 +3,27 @@ import { lazyLoadComponent } from "./dynamic-routing/component-loader"; import { endpoints } from "../constants/mock-endpoints"; import globalMethods from "@/global-methods"; +const issPageValues = require("./router-constants/issPage-values"); + const routes = [ { path: '/', name: 'root', async beforeEnter(to, from, next) { try { - if (router.hasRoute(to.query.issPage)) { - return next({ name: to.query.issPage, query: to.query, params: to.params }); + + let issPage = to.query.issPage; + + if(issPage === undefined) + { + issPage = issPageValues.issPageValues["WELCOME_PAGE"]; } - const routeData = await GetRouteInfoFromPageName(to.query.issPage); + + if (router.hasRoute(issPage)) { + return next({ name: issPage, query: to.query, params: to.params }); + } + + const routeData = await GetRouteInfoFromPageName(issPage); if(routeData[0].name.toLowerCase() === "error") { @@ -26,7 +37,7 @@ const routes = [ component: routeData[0].component, }); - // Assign current query string parameters, as well as our fmgPage one. + // Assign current query string parameters, as well as our issPage one. next({ name: routeData[0].name, query: Object.assign(to.query, { issPage: routeData[0].name }), @@ -88,7 +99,7 @@ async function navigate(scenario, currentRoute, optionalQuery = {}, optionalPara router.push({ name: "root", query: Object.assign(optionalQuery, { - fmgPage: destinationIssPageValue, + issPage: destinationIssPageValue, }), params: optionalParams }); @@ -113,7 +124,7 @@ function getNavigationMap(scenario, currentRoute) { } function GoToStartOn404(next) { - const errorPageName = "error-404" + const errorPageName = issPageValues.issPageValues.ERROR_404; router.addRoute({ path: "/", name: errorPageName, diff --git a/src/router/router-constants/issPage-values.js b/src/router/router-constants/issPage-values.js index 1c1bbde6..8bdc935c 100644 --- a/src/router/router-constants/issPage-values.js +++ b/src/router/router-constants/issPage-values.js @@ -1,5 +1,7 @@ -const issPageValues = { +export const issPageValues = { + ERROR_404: "error-404", + WELCOME_PAGE: "welcome-page", + VEHICLE_MAKE: "vehicle-make", VEHICLE_YEAR: "vehicle-year", }; - - export { issPageValues }; \ No newline at end of file + \ No newline at end of file diff --git a/src/router/router-constants/routing-table.js b/src/router/router-constants/routing-table.js index 5e11bbc6..edce4e74 100644 --- a/src/router/router-constants/routing-table.js +++ b/src/router/router-constants/routing-table.js @@ -5,14 +5,23 @@ import { navigationScenarios } from "@/router/router-constants/navigation-scenar const routingTable = function(store) { return [ { - issPageValue: issPageValues.VEHICLE_YEAR, + issPageValue: issPageValues.VEHICLE_MAKE, maps: [ { - scenario: navigationScenarios.SELECTED_YEAR, - issPageValue: "PageOne" + scenario: navigationScenarios.CLICKED_BACK, + issPageValue: "WELCOME_PAGE" }, ], }, + { + issPageVlue: issPageValues.WELCOME_PAGE, + maps: [ + { + scenario: navigationScenarios.CLICKED_FORWARD, + issPageValue: "VEHICLE_MAKE" + } + ] + } ]; }; From d1c334a8c57a984fb60127b105bb385fb00316dc Mon Sep 17 00:00:00 2001 From: Jason Wheeler Date: Tue, 20 Sep 2022 10:27:53 -0400 Subject: [PATCH 2/3] updated to dot notation --- src/router/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/router/index.js b/src/router/index.js index 10919978..f3a17dcf 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -16,7 +16,7 @@ const routes = [ if(issPage === undefined) { - issPage = issPageValues.issPageValues["WELCOME_PAGE"]; + issPage = issPageValues.issPageValues.WELCOME_PAGE; } if (router.hasRoute(issPage)) { From 1e744d793c28e297ae73d65b23a7ba383371b5d2 Mon Sep 17 00:00:00 2001 From: Jason Wheeler Date: Tue, 20 Sep 2022 14:43:58 -0400 Subject: [PATCH 3/3] updated to standard import language after discussing with Frank about why I couldn't inspect the object in the console. --- src/router/index.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/router/index.js b/src/router/index.js index f3a17dcf..364b3183 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -2,8 +2,8 @@ import { createWebHistory, createRouter } from "vue-router"; import { lazyLoadComponent } from "./dynamic-routing/component-loader"; import { endpoints } from "../constants/mock-endpoints"; import globalMethods from "@/global-methods"; +import {issPageValues} from '@/router/router-constants/issPage-values'; -const issPageValues = require("./router-constants/issPage-values"); const routes = [ { @@ -16,7 +16,7 @@ const routes = [ if(issPage === undefined) { - issPage = issPageValues.issPageValues.WELCOME_PAGE; + issPage = issPageValues.WELCOME_PAGE; } if (router.hasRoute(issPage)) { @@ -124,7 +124,7 @@ function getNavigationMap(scenario, currentRoute) { } function GoToStartOn404(next) { - const errorPageName = issPageValues.issPageValues.ERROR_404; + const errorPageName = issPageValues.ERROR_404; router.addRoute({ path: "/", name: errorPageName,