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,
|
||||
}, false);
|
||||
|
||||
if (!zipCodeData.isZipValid) {
|
||||
if (!zipCodeData.isValid) {
|
||||
this.displayInvalidZipAlert = true;
|
||||
return this.$refs.funnelFooter.removeLoader();
|
||||
}
|
||||
this.displayInvalidZipAlert = false;
|
||||
|
||||
if (!zipCodeData.isZipServiceable) {
|
||||
if (!zipCodeData.isServiceable) {
|
||||
this.displayNonServiceableZipAlert = true;
|
||||
return this.$refs.funnelFooter.removeLoader();
|
||||
}
|
||||
|
|
@ -220,7 +220,6 @@ export default {
|
|||
},
|
||||
computed: {
|
||||
AlertNonServiceableZipHeader(){
|
||||
console.log(this.getCmsContent("AlertNonServiceableZipWidget", "HeadlineText"));
|
||||
return this.getCmsContent("AlertNonServiceableZipWidget", "HeadlineText").replaceAll("{custom:serviceZip}", this.serviceZipCode);
|
||||
},
|
||||
AlertNonServiceableZipBody(){
|
||||
|
|
|
|||
|
|
@ -238,13 +238,16 @@ export default {
|
|||
resultKey: "vehicleLookupResponse",
|
||||
promise: vehicleLookupResponse,
|
||||
},
|
||||
{
|
||||
resultKey: "zipCodeData",
|
||||
promise: this.getZipCodeData(this.serviceZipCode)
|
||||
}
|
||||
];
|
||||
|
||||
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
|
||||
const isZipValid = zipCodeData.isValid;
|
||||
const isZipValid = resultMap.zipCodeData.isValid;
|
||||
if (this.serviceZipCode && !isZipValid) {
|
||||
this.displayInvalidZipAlert = true;
|
||||
return this.$refs.funnelFooter.removeLoader();
|
||||
|
|
@ -252,14 +255,14 @@ export default {
|
|||
this.displayInvalidZipAlert = false;
|
||||
|
||||
// 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(!resultMap.vehicleLookupResponse) {
|
||||
this.displayVinNotFoundAlert = true;
|
||||
}
|
||||
|
||||
// Check if Service Zip entered is serviceable, if not display an alert
|
||||
if (!zipCodeData.isServiceable) {
|
||||
if (!resultMap.zipCodeData.isServiceable) {
|
||||
this.displayNonServiceableZipAlert = true;
|
||||
}
|
||||
|
||||
|
|
@ -293,7 +296,7 @@ export default {
|
|||
await this.dispatchStoreAction(storeActions.SAVE_EMAIL, this.emailAddress, false);
|
||||
await this.dispatchStoreAction(storeActions.SAVE_SERVICE_LOCATION, {
|
||||
zipCode: this.serviceZipCode,
|
||||
state: zipCodeData.state,
|
||||
state: resultMap.zipCodeData.state,
|
||||
}, false);
|
||||
|
||||
return await this.navigateForward();
|
||||
|
|
|
|||
|
|
@ -49,21 +49,12 @@ export default {
|
|||
return footerInfoBox ? footerInfoBox.offsetHeight : 0;
|
||||
},
|
||||
async getZipCodeData(zipCode) {
|
||||
const serviceZipValidationResponse = this.dispatchStoreAction(storeActions.VALIDATE_ZIP, { zip: zipCode });
|
||||
|
||||
const promiseResultMap = [
|
||||
{
|
||||
resultKey: "serviceZipValidationResponse",
|
||||
promise: serviceZipValidationResponse,
|
||||
}
|
||||
];
|
||||
|
||||
const resultMap = await settleAllPromises(promiseResultMap);
|
||||
|
||||
const serviceZipValidationResponse = await this.dispatchStoreAction(storeActions.VALIDATE_ZIP, { zip: zipCode });
|
||||
|
||||
return {
|
||||
isZipValid: resultMap.serviceZipValidationResponse.isValid,
|
||||
isZipServiceable: resultMap.serviceZipValidationResponse.isServiceable,
|
||||
state: resultMap.serviceZipValidationResponse.state
|
||||
isValid: serviceZipValidationResponse.data.isValid,
|
||||
isServiceable: serviceZipValidationResponse.data.isServiceable,
|
||||
state: serviceZipValidationResponse.data.state
|
||||
};
|
||||
}
|
||||
},
|
||||
|
|
|
|||
Loading…
Reference in a new issue