Adding functionality to radio buttons on year pages
This commit is contained in:
parent
b6e0a02deb
commit
d589ce1b9c
2 changed files with 17 additions and 9 deletions
|
|
@ -13,11 +13,11 @@
|
|||
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";
|
||||
// Supporting files
|
||||
import { fetchCmsContentForPage } from "@/helpers/cms-content-helper";
|
||||
import { settleAllPromises } from "@/helpers/layout-helper";
|
||||
import store from "@/store";
|
||||
import { storeActions } from "@/constants/store-actions.js";
|
||||
|
||||
export default {
|
||||
name: "vehicle-year",
|
||||
data() {
|
||||
|
|
@ -29,10 +29,8 @@ export default {
|
|||
},
|
||||
computed: {},
|
||||
beforeRouteEnter(to, from, next) {
|
||||
|
||||
const contentPromise = fetchCmsContentForPage(to.query.fmgPage);
|
||||
const getVehicleYearPromise = store.dispatch(storeActions.GET_VEHICLE_YEARS, {});
|
||||
|
||||
const promiseResultMap = [
|
||||
{
|
||||
resultKey: "getPageContent",
|
||||
|
|
@ -43,9 +41,7 @@ export default {
|
|||
promise: getVehicleYearPromise,
|
||||
},
|
||||
];
|
||||
|
||||
settleAllPromises(promiseResultMap).then((resultMap) => {
|
||||
|
||||
// Call our next function to transition to the next page.
|
||||
next((vm) => {
|
||||
vm.pageHeaderWidgets = resultMap.getPageContent.PageHeaderWidget[0];
|
||||
|
|
@ -54,12 +50,11 @@ export default {
|
|||
});
|
||||
|
||||
});
|
||||
|
||||
},
|
||||
components: {
|
||||
yearQuestion,
|
||||
pageHeader,
|
||||
vehicleBanner,
|
||||
vehicleBanner
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
|
@ -67,7 +62,6 @@ export default {
|
|||
<style lang="scss">
|
||||
.select-car {
|
||||
height: calc(100vh - 1rem);
|
||||
|
||||
.car_list {
|
||||
// Height will be determined by overall height of content above list
|
||||
height: calc(100% - 255px);
|
||||
|
|
|
|||
|
|
@ -22,7 +22,21 @@ export default {
|
|||
},
|
||||
methods: {
|
||||
selectYear(year){
|
||||
this.$store.commit(this.storeMutations.UPDATE_YEAR, year);
|
||||
const awaitYearUpdate = new Promise((resolve, reject) => {
|
||||
this.$store.commit(this.storeMutations.UPDATE_YEAR, year);
|
||||
|
||||
if(this.$store.state.order.vehicle.year !== null) {
|
||||
resolve('ok');
|
||||
} else {
|
||||
reject('error occured');
|
||||
}
|
||||
});
|
||||
|
||||
awaitYearUpdate.then(() => {
|
||||
this.$router.push('?fmgPage=vehicle-make');
|
||||
}).catch((error) => {
|
||||
console.log(error);
|
||||
});
|
||||
}
|
||||
},
|
||||
};
|
||||
|
|
|
|||
Loading…
Reference in a new issue