Merge pull request #1359 from Safelite/feature/CSR-1652

CSR-1652
This commit is contained in:
AMSNEHA 2023-09-26 19:25:09 +05:30 committed by GitHub
commit 99896cad89
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -264,8 +264,13 @@ export default {
model model
); );
this.styleOptions = result?.data; this.styleOptions = result?.data;
if (this.styleOptions.length === 1) this.selectedStyle = this.styleOptions[0]; if (this.styleOptions.length === 1) {
else this.selectedStyle = null; const sameStyle = this.selectedStyle === this.styleOptions[0];
this.selectedStyle = this.styleOptions[0];
if (sameStyle) {
this.getVehicleDetails();
}
} else this.selectedStyle = null;
} else { } else {
this.styleOptions = []; this.styleOptions = [];
this.selectedStyle = null; this.selectedStyle = null;
@ -273,18 +278,7 @@ export default {
}, },
async selectedStyle(style) { async selectedStyle(style) {
if (style) { if (style) {
this.carId = null; this.getVehicleDetails();
const result = await this.getVehicle(
this.selectedYear,
this.selectedMake,
this.selectedModel,
style
);
this.carId = result?.data.carId;
this.category = result?.data.category;
this.imageUrl = result?.data.imageUrl;
this.imageVifNumber = result?.data.imageVifNumber;
this.imageVifColor = result?.data.imageVifColor;
} else { } else {
this.imageUrl = null; this.imageUrl = null;
} }
@ -318,6 +312,20 @@ export default {
arePagePrerequisitesValid() { arePagePrerequisitesValid() {
return true; return true;
}, },
async getVehicleDetails() {
this.carId = null;
const result = await this.getVehicle(
this.selectedYear,
this.selectedMake,
this.selectedModel,
this.selectedStyle
);
this.carId = result?.data.carId;
this.category = result?.data.category;
this.imageUrl = result?.data.imageUrl;
this.imageVifNumber = result?.data.imageVifNumber;
this.imageVifColor = result?.data.imageVifColor;
},
async forwardButtonAction() { async forwardButtonAction() {
this.dispatchStoreAction( this.dispatchStoreAction(