diff --git a/src/global-methods.js b/src/global-methods.js index 7da6ed06..b01536e6 100644 --- a/src/global-methods.js +++ b/src/global-methods.js @@ -5,7 +5,7 @@ export default { callHttpClient({ method, endpoint, payload}) { return new Promise((resolve, reject) => { const cfDistroUrl = applicationConfig.CONSUMER_CF_DISTRO; - const payloadAndAnalyticsData = Object.assign({}, payload, { AppName: "FixMyGlass" }); + const payloadAndAnalyticsData = Object.assign({}, payload, { AppName: "SelfService" }); axios({ method: method, url: cfDistroUrl + endpoint, data: payloadAndAnalyticsData, crossDomain: true, responseType: {}}) .then((response) => { diff --git a/src/router/index.js b/src/router/index.js index 043e60c8..0c4cf138 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -1,5 +1,7 @@ import { storeActions } from "@/constants/store-actions"; +import { storeMutations } from "@/constants/store-mutations"; import { createWebHistory, createRouter } from "vue-router"; + const routes = [ { path: '/', @@ -38,6 +40,27 @@ const router = createRouter({ routes, }); +// Get route information by page name. +// This will reach out to the Cms and there is a 1:1 relationship between page names and route names. +async function GetRouteInfoFromPageName(pageName) { + const response = await store.dispatch(storeActions.GET_ROUTE_INFO_ACTION, { + pageName: pageName, + }); + const jsonFromResponse = JSON.parse(response.data.Result); + let routeData = []; + + // Add our route data and return our array. + Object.keys(jsonFromResponse).forEach((key) => { + routeData.push({ + path: "/", + name: `${key}`, + component: lazyLoadComponent(jsonFromResponse[key].LayoutName), + }); + }); + + return routeData; + } + // Navigate to the next route, depending on the scenario. async function navigate(scenario, currentRoute, optionalQuery = {}, optionalParams = {}) { if (!scenario) { diff --git a/src/store/index.js b/src/store/index.js index 02c9ab2e..6acc99d8 100644 --- a/src/store/index.js +++ b/src/store/index.js @@ -2,6 +2,9 @@ import { createStore } from "vuex"; import { endpoints } from "@/constants/endpoints.js"; import createPersistedState from "vuex-persistedstate"; import globalMethods from "@/global-methods"; +import { storeActions } from "@/constants/store-actions"; +import { applicationConfig } from "@/constants/application-config"; +import { issPageValues } from "@/router/router-constants/issPage-values"; // Export State const getDefaultState = () => {