Merge pull request #68 from Safelite/feature/misc-comments

miscellaneous comments
This commit is contained in:
Mark Harris 2021-12-02 08:12:03 -05:00 committed by GitHub
commit b91170de61
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 5 deletions

View file

@ -30,11 +30,14 @@ export default {
};
},
computed: {},
beforeRouteEnter(to, from, next) {
// Call APIs
const contentPromise = fetchCmsContentForPage(to.query.fmgPage);
const getVehicleYearPromise = store.dispatch(storeActions.GET_VEHICLE_YEARS, {});
// Settle promises and get results
const promiseResultMap = [
{
resultKey: "getPageContent",
@ -45,19 +48,17 @@ export default {
promise: getVehicleYearPromise,
},
];
settleAllPromises(promiseResultMap).then((resultMap) => {
// Call our next function to transition to the next page.
// Call the "next" function to complete the transition to this page.
next((vm) => {
vm.pageHeaderWidgets = resultMap.getPageContent.PageHeaderWidget[0];
vm.radioQuestionWidgets = resultMap.getPageContent.RadioQuestionWidget[0];
vm.vehicleYears = resultMap.getVehicleYear;
});
});
});
},
components: {
yearQuestion,
pageHeader,

View file

@ -9,6 +9,11 @@ export default createStore({
storage: window.sessionStorage,
}),
],
// IMPORTANT: Be VERY careful when modifying these fields for at least a few reasons:
// * The CMS can reference the fields by name
// * Return users may have a previous "version" of the model, and we don't want
// them to have a breaking experience, because the model might have changed.
state: {
order: {
vehicle: {
@ -63,6 +68,8 @@ export default createStore({
experiments: null,
}
},
// See IMPORTANT note at top of "state" declaration.
mutations: {
updateVehicleImage(state, data) {
state.order.vehicle.imageSrc = data.imgSrc;