This commit is contained in:
CarlNation 2022-11-29 09:31:27 -05:00
parent b2d1ce3693
commit 0043f57a9e
2 changed files with 14 additions and 6 deletions

View file

@ -76,10 +76,10 @@ async function getLatestPageForRedirection() {
const vinOptionalVehiclePromise = store.dispatch(storeActions.IS_VIN_OPTIONAL_VEHICLE);
const promiseResultMap = [
{
resultKey: "vinOptionalOptions",
promise: vinOptionalVehiclePromise,
},
{
resultKey: "vinOptionalOptions",
promise: vinOptionalVehiclePromise,
},
];
const resultMap = await settleAllPromises(promiseResultMap);

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,