CSR-779 remove promise settle from mixin
This commit is contained in:
parent
f25b43dc6b
commit
a50c2220ed
3 changed files with 15 additions and 22 deletions
|
|
@ -181,13 +181,13 @@ export default {
|
||||||
state: zipCodeData.state,
|
state: zipCodeData.state,
|
||||||
}, false);
|
}, false);
|
||||||
|
|
||||||
if (!zipCodeData.isZipValid) {
|
if (!zipCodeData.isValid) {
|
||||||
this.displayInvalidZipAlert = true;
|
this.displayInvalidZipAlert = true;
|
||||||
return this.$refs.funnelFooter.removeLoader();
|
return this.$refs.funnelFooter.removeLoader();
|
||||||
}
|
}
|
||||||
this.displayInvalidZipAlert = false;
|
this.displayInvalidZipAlert = false;
|
||||||
|
|
||||||
if (!zipCodeData.isZipServiceable) {
|
if (!zipCodeData.isServiceable) {
|
||||||
this.displayNonServiceableZipAlert = true;
|
this.displayNonServiceableZipAlert = true;
|
||||||
return this.$refs.funnelFooter.removeLoader();
|
return this.$refs.funnelFooter.removeLoader();
|
||||||
}
|
}
|
||||||
|
|
@ -220,7 +220,6 @@ export default {
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
AlertNonServiceableZipHeader(){
|
AlertNonServiceableZipHeader(){
|
||||||
console.log(this.getCmsContent("AlertNonServiceableZipWidget", "HeadlineText"));
|
|
||||||
return this.getCmsContent("AlertNonServiceableZipWidget", "HeadlineText").replaceAll("{custom:serviceZip}", this.serviceZipCode);
|
return this.getCmsContent("AlertNonServiceableZipWidget", "HeadlineText").replaceAll("{custom:serviceZip}", this.serviceZipCode);
|
||||||
},
|
},
|
||||||
AlertNonServiceableZipBody(){
|
AlertNonServiceableZipBody(){
|
||||||
|
|
|
||||||
|
|
@ -238,13 +238,16 @@ export default {
|
||||||
resultKey: "vehicleLookupResponse",
|
resultKey: "vehicleLookupResponse",
|
||||||
promise: vehicleLookupResponse,
|
promise: vehicleLookupResponse,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
resultKey: "zipCodeData",
|
||||||
|
promise: this.getZipCodeData(this.serviceZipCode)
|
||||||
|
}
|
||||||
];
|
];
|
||||||
|
|
||||||
const resultMap = await settleAllPromises(promiseResultMap);
|
const resultMap = await settleAllPromises(promiseResultMap);
|
||||||
const zipCodeData = await this.getZipCodeData(this.serviceZipCode);
|
|
||||||
|
|
||||||
// If a Service Zip is entered and it is an invalid zip code (ex. 11111) then show an alert
|
// If a Service Zip is entered and it is an invalid zip code (ex. 11111) then show an alert
|
||||||
const isZipValid = zipCodeData.isValid;
|
const isZipValid = resultMap.zipCodeData.isValid;
|
||||||
if (this.serviceZipCode && !isZipValid) {
|
if (this.serviceZipCode && !isZipValid) {
|
||||||
this.displayInvalidZipAlert = true;
|
this.displayInvalidZipAlert = true;
|
||||||
return this.$refs.funnelFooter.removeLoader();
|
return this.$refs.funnelFooter.removeLoader();
|
||||||
|
|
@ -252,14 +255,14 @@ export default {
|
||||||
this.displayInvalidZipAlert = false;
|
this.displayInvalidZipAlert = false;
|
||||||
|
|
||||||
// If either lookup fails, remove the loader and stop processing the page.
|
// If either lookup fails, remove the loader and stop processing the page.
|
||||||
if (!resultMap.vehicleLookupResponse || !zipCodeData.isServiceable) {
|
if (!resultMap.vehicleLookupResponse || !resultMap.zipCodeData.isServiceable) {
|
||||||
// If the vehicle result is undefined, the vin entered was invalid.
|
// If the vehicle result is undefined, the vin entered was invalid.
|
||||||
if(!resultMap.vehicleLookupResponse) {
|
if(!resultMap.vehicleLookupResponse) {
|
||||||
this.displayVinNotFoundAlert = true;
|
this.displayVinNotFoundAlert = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check if Service Zip entered is serviceable, if not display an alert
|
// Check if Service Zip entered is serviceable, if not display an alert
|
||||||
if (!zipCodeData.isServiceable) {
|
if (!resultMap.zipCodeData.isServiceable) {
|
||||||
this.displayNonServiceableZipAlert = true;
|
this.displayNonServiceableZipAlert = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -293,7 +296,7 @@ export default {
|
||||||
await this.dispatchStoreAction(storeActions.SAVE_EMAIL, this.emailAddress, false);
|
await this.dispatchStoreAction(storeActions.SAVE_EMAIL, this.emailAddress, false);
|
||||||
await this.dispatchStoreAction(storeActions.SAVE_SERVICE_LOCATION, {
|
await this.dispatchStoreAction(storeActions.SAVE_SERVICE_LOCATION, {
|
||||||
zipCode: this.serviceZipCode,
|
zipCode: this.serviceZipCode,
|
||||||
state: zipCodeData.state,
|
state: resultMap.zipCodeData.state,
|
||||||
}, false);
|
}, false);
|
||||||
|
|
||||||
return await this.navigateForward();
|
return await this.navigateForward();
|
||||||
|
|
|
||||||
|
|
@ -49,21 +49,12 @@ export default {
|
||||||
return footerInfoBox ? footerInfoBox.offsetHeight : 0;
|
return footerInfoBox ? footerInfoBox.offsetHeight : 0;
|
||||||
},
|
},
|
||||||
async getZipCodeData(zipCode) {
|
async getZipCodeData(zipCode) {
|
||||||
const serviceZipValidationResponse = this.dispatchStoreAction(storeActions.VALIDATE_ZIP, { zip: zipCode });
|
const serviceZipValidationResponse = await this.dispatchStoreAction(storeActions.VALIDATE_ZIP, { zip: zipCode });
|
||||||
|
|
||||||
const promiseResultMap = [
|
|
||||||
{
|
|
||||||
resultKey: "serviceZipValidationResponse",
|
|
||||||
promise: serviceZipValidationResponse,
|
|
||||||
}
|
|
||||||
];
|
|
||||||
|
|
||||||
const resultMap = await settleAllPromises(promiseResultMap);
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
isZipValid: resultMap.serviceZipValidationResponse.isValid,
|
isValid: serviceZipValidationResponse.data.isValid,
|
||||||
isZipServiceable: resultMap.serviceZipValidationResponse.isServiceable,
|
isServiceable: serviceZipValidationResponse.data.isServiceable,
|
||||||
state: resultMap.serviceZipValidationResponse.state
|
state: serviceZipValidationResponse.data.state
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue