async hook with v-if, added state objects

This commit is contained in:
Frank 2021-11-17 17:51:06 -05:00
parent 7a5a537cd4
commit a5ec3b322b
4 changed files with 62 additions and 11 deletions

View file

@ -1,5 +1,5 @@
<template>
<div class="select-car">
<div v-if="isPageReady" class="select-car">
<div class="select-car-form rounded text-center">
<Header :text="headerTextWidgets[0].HeaderText" class="Header" />
<yearQuestion :questionText="radioQuestionWidgets[0].QuestionText" />
@ -17,16 +17,16 @@ export default {
return {
headerTextWidgets: {},
radioQuestionWidgets: {},
isPageReady: false,
};
},
computed: {},
created() {
let self = this;
this.GetContentFromCms().then(response => {
self.headerTextWidgets = response.HeaderTextWidget;
self.radioQuestionWidgets = response.RadioQuestionWidget;
});
async created() {
const pageContent = await this.GetContentFromCms();
this.headerTextWidgets = pageContent.HeaderTextWidget;
this.radioQuestionWidgets = pageContent.RadioQuestionWidget;
this.isPageReady = true;
},
components: {

View file

@ -1,5 +1,5 @@
<template>
<radioQuestion class="radioQuestion" :questionText="questionText" :answers="years" :chooseAnswer="selectYear" />
<radioQuestion class="radioQuestion" :questionText="questionText" :answers="years" />
</template>
<script>

View file

@ -34,7 +34,6 @@ export default {
pageDataFromCms[widget.Type] = [widget.Model];
}
});
return pageDataFromCms;
});
},

View file

@ -9,7 +9,59 @@ export default createStore({
storage: window.sessionStorage,
}),
],
state: {},
state: {
order: {
vehicle: {
year: 0,
make: '',
model: '',
style: '',
vin: '',
licensePlate: '',
carId: '',
evoxImageId: '',
hasSplitWindshieldOption: false,
hasBackglassSliderOption: false,
registration: {
rawAddress: '',
zipCode: '',
firstName: '',
lastName: '',
licensePlate: ''
},
damage: {
isRepair: false,
isReplacement: false,
numberOfChips: 0,
glassToReplace: [],
problemGlassQuestions: [],
problemMoldingQuestions: [],
problemPropertyQuestions: [],
},
items: [],
customer: {
emailAddress: '',
firstName: '',
lastName: '',
phoneNumber: {
isMobile: false,
optInSms: false,
}
},
payment: {
isInsurance: false,
isCash: false,
},
referral: {
referralSeqNum: 0,
workOrderId: ''
}
}
},
applicationUser: {
experiments: [],
}
},
mutations: {},
actions: {
// Vehicle API Actions