This commit is contained in:
Kulbhushan Kaushik 2022-09-15 14:25:44 -04:00
parent 45981d3ce2
commit f8b4136070
3 changed files with 27 additions and 1 deletions

View file

@ -5,7 +5,7 @@ export default {
callHttpClient({ method, endpoint, payload}) { callHttpClient({ method, endpoint, payload}) {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
const cfDistroUrl = applicationConfig.CONSUMER_CF_DISTRO; 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: {}}) axios({ method: method, url: cfDistroUrl + endpoint, data: payloadAndAnalyticsData, crossDomain: true, responseType: {}})
.then((response) => { .then((response) => {

View file

@ -1,5 +1,7 @@
import { storeActions } from "@/constants/store-actions"; import { storeActions } from "@/constants/store-actions";
import { storeMutations } from "@/constants/store-mutations";
import { createWebHistory, createRouter } from "vue-router"; import { createWebHistory, createRouter } from "vue-router";
const routes = [ const routes = [
{ {
path: '/', path: '/',
@ -38,6 +40,27 @@ const router = createRouter({
routes, 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. // Navigate to the next route, depending on the scenario.
async function navigate(scenario, currentRoute, optionalQuery = {}, optionalParams = {}) { async function navigate(scenario, currentRoute, optionalQuery = {}, optionalParams = {}) {
if (!scenario) { if (!scenario) {

View file

@ -2,6 +2,9 @@ import { createStore } from "vuex";
import { endpoints } from "@/constants/endpoints.js"; import { endpoints } from "@/constants/endpoints.js";
import createPersistedState from "vuex-persistedstate"; import createPersistedState from "vuex-persistedstate";
import globalMethods from "@/global-methods"; 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 // Export State
const getDefaultState = () => { const getDefaultState = () => {