Merge pull request #840 from Safelite/feature/CSR-944-to-develop

CSR-944
This commit is contained in:
CarlNation 2022-11-29 09:47:22 -05:00 committed by GitHub
commit 60e2a069a9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -132,19 +132,27 @@ export default {
async beforeRouteEnter(to, from, next) {
//Call APIs
const cmsContentPromise = fetchCmsContentForPage(to.query.fmgPage);
const vinOptionalVehiclePromise = store.dispatch(storeActions.IS_VIN_OPTIONAL_VEHICLE);
//Settle promises and get results
const promiseResultMap = [
{
resultKey: "cmsContent",
promise: cmsContentPromise,
},
{
resultKey: "vinOptionalOptions",
promise: vinOptionalVehiclePromise,
},
];
const resultMap = await settleAllPromises(promiseResultMap);
next((vm) => {
vm.isVinOptionalVehicle = resultMap.vinOptionalOptions;
if (resultMap.cmsContent.FunnelFooterWidget.ForwardButtonText.includes("|")) {
const forwardTextOption =
resultMap.cmsContent.FunnelFooterWidget.ForwardButtonText.split("|");
if (store.getters.damage.isRepair) {
if (store.getters.damage.isRepair || vm.isVinOptionalVehicle) {
resultMap.cmsContent.FunnelFooterWidget.ForwardButtonText =
forwardTextOption[1];
} else {
@ -173,7 +181,7 @@ export default {
async forwardButtonAction() {
if (this.skipVinLookup) {
const zipCodeData = await this.getZipCodeData(this.serviceZipCode);
//todo: validation
await this.dispatchStoreAction(storeActions.SAVE_EMAIL, this.emailAddress, false);
await this.dispatchStoreAction(
storeActions.SAVE_SERVICE_LOCATION,