CSR-120: undo temporary testing changes

This commit is contained in:
Adam Caouette 2021-11-30 13:42:52 -05:00
parent 8ba2d3acae
commit 13f819262c
3 changed files with 35 additions and 49 deletions

View file

@ -1,31 +0,0 @@
import { storeActions } from "@/constants/store-actions.js";
import { widgetNames } from "@/constants/widget-names.js";
import store from "@/store";
export function GetContentFromCms(fmgPage) {
return store.dispatch(storeActions.GET_PAGE_DATA, { pageName: fmgPage }).then((response) => {
const pageDataFromCms = {
isCmsContentReady: false
};
response.data.Result.forEach((widget) => {
if (Object.values(widgetNames).includes(widget.Type)) {
// If we already have this widget, push it on the collection
if (widget.Type in pageDataFromCms) {
pageDataFromCms[widget.Type].push(widget.Model);
return;
}
pageDataFromCms[widget.Type] = [widget.Model];
}
});
// Our 'Page' is ready because we have data now
pageDataFromCms.isCmsContentReady = true;
return pageDataFromCms;
});
}

View file

@ -1,4 +1,4 @@
<template>
<template v-if="isCmsContentReady">
<div class="select-car">
<div class="select-car-form rounded text-center">
<vehicleBanner />
@ -12,9 +12,6 @@
import yearQuestion from "@/layouts/vehicle-year/year-question/year-question";
import pageHeader from "@/ux-components/header/header";
import vehicleBanner from "@/common-components/vehicle-banner/vehicle-banner";
import {
GetContentFromCms
} from "@/helpers/cms-adapter";
export default {
name: "vehicle-year",
@ -25,14 +22,10 @@ export default {
};
},
computed: {},
beforeRouteEnter(to, from, next) {
GetContentFromCms(to.query.fmgPage).then((response) => {
console.log(response)
next(vm => {
vm.pageHeaderWidgets = response.PageHeaderWidget[0];
vm.radioQuestionWidgets = response.RadioQuestionWidget[0];
});
});
async created() {
const pageContent = await this.GetContentFromCms();
this.pageHeaderWidgets = pageContent.PageHeaderWidget[0];
this.radioQuestionWidgets = pageContent.RadioQuestionWidget[0];
},
components: {
yearQuestion,

View file

@ -8,13 +8,13 @@ export default {
}
},
methods: {
dispatchBlockingStoreAction(type, payload) {
// globalMethods.showWaitingModal(true);
// dispatchBlockingStoreAction(type, payload) {
// // globalMethods.showWaitingModal(true);
return this.dispatchNonBlockingStoreAction(type, payload).finally(() => {
// globalMethods.showWaitingModal(false);
});
},
// return this.dispatchNonBlockingStoreAction(type, payload).finally(() => {
// // globalMethods.showWaitingModal(false);
// });
// },
dispatchNonBlockingStoreAction(type, payload, encodePayload = false) {
// Encode the payload if required
if (encodePayload) {
@ -23,6 +23,30 @@ export default {
return this.$store.dispatch(type, payload);
},
GetContentFromCms() {
return this.dispatchNonBlockingStoreAction(this.storeActions.GET_PAGE_DATA,{ pageName: this.$route.query.fmgPage }).then((response) => {
const pageDataFromCms = {};
response.data.Result.forEach((widget) => {
if (Object.values(this.widgetNames).includes(widget.Type)) {
// If we already have this widget, push it on the collection
if (widget.Type in pageDataFromCms) {
pageDataFromCms[widget.Type].push(widget.Model);
return;
}
pageDataFromCms[widget.Type] = [widget.Model];
}
});
// Our 'Page' is ready because we have data now
this.isCmsContentReady = true;
return pageDataFromCms;
});
},
},
computed: {
storeActions() {