CSR-120: undo temporary testing changes
This commit is contained in:
parent
8ba2d3acae
commit
13f819262c
3 changed files with 35 additions and 49 deletions
|
|
@ -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;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
<template>
|
<template v-if="isCmsContentReady">
|
||||||
<div class="select-car">
|
<div class="select-car">
|
||||||
<div class="select-car-form rounded text-center">
|
<div class="select-car-form rounded text-center">
|
||||||
<vehicleBanner />
|
<vehicleBanner />
|
||||||
|
|
@ -12,9 +12,6 @@
|
||||||
import yearQuestion from "@/layouts/vehicle-year/year-question/year-question";
|
import yearQuestion from "@/layouts/vehicle-year/year-question/year-question";
|
||||||
import pageHeader from "@/ux-components/header/header";
|
import pageHeader from "@/ux-components/header/header";
|
||||||
import vehicleBanner from "@/common-components/vehicle-banner/vehicle-banner";
|
import vehicleBanner from "@/common-components/vehicle-banner/vehicle-banner";
|
||||||
import {
|
|
||||||
GetContentFromCms
|
|
||||||
} from "@/helpers/cms-adapter";
|
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "vehicle-year",
|
name: "vehicle-year",
|
||||||
|
|
@ -25,14 +22,10 @@ export default {
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
computed: {},
|
computed: {},
|
||||||
beforeRouteEnter(to, from, next) {
|
async created() {
|
||||||
GetContentFromCms(to.query.fmgPage).then((response) => {
|
const pageContent = await this.GetContentFromCms();
|
||||||
console.log(response)
|
this.pageHeaderWidgets = pageContent.PageHeaderWidget[0];
|
||||||
next(vm => {
|
this.radioQuestionWidgets = pageContent.RadioQuestionWidget[0];
|
||||||
vm.pageHeaderWidgets = response.PageHeaderWidget[0];
|
|
||||||
vm.radioQuestionWidgets = response.RadioQuestionWidget[0];
|
|
||||||
});
|
|
||||||
});
|
|
||||||
},
|
},
|
||||||
components: {
|
components: {
|
||||||
yearQuestion,
|
yearQuestion,
|
||||||
|
|
|
||||||
|
|
@ -8,13 +8,13 @@ export default {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
dispatchBlockingStoreAction(type, payload) {
|
// dispatchBlockingStoreAction(type, payload) {
|
||||||
// globalMethods.showWaitingModal(true);
|
// // globalMethods.showWaitingModal(true);
|
||||||
|
|
||||||
return this.dispatchNonBlockingStoreAction(type, payload).finally(() => {
|
// return this.dispatchNonBlockingStoreAction(type, payload).finally(() => {
|
||||||
// globalMethods.showWaitingModal(false);
|
// // globalMethods.showWaitingModal(false);
|
||||||
});
|
// });
|
||||||
},
|
// },
|
||||||
dispatchNonBlockingStoreAction(type, payload, encodePayload = false) {
|
dispatchNonBlockingStoreAction(type, payload, encodePayload = false) {
|
||||||
// Encode the payload if required
|
// Encode the payload if required
|
||||||
if (encodePayload) {
|
if (encodePayload) {
|
||||||
|
|
@ -23,6 +23,30 @@ export default {
|
||||||
|
|
||||||
return this.$store.dispatch(type, payload);
|
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: {
|
computed: {
|
||||||
storeActions() {
|
storeActions() {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue