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
);
this.styleOptions = result?.data;
if (this.styleOptions.length === 1) this.selectedStyle = this.styleOptions[0];
else this.selectedStyle = null;
if (this.styleOptions.length === 1) {
const sameStyle = this.selectedStyle === this.styleOptions[0];
this.selectedStyle = this.styleOptions[0];
if (sameStyle) {
this.getVehicleDetails();
}
} else this.selectedStyle = null;
} else {
this.styleOptions = [];
this.selectedStyle = null;
@ -273,18 +278,7 @@ export default {
},
async selectedStyle(style) {
if (style) {
this.carId = null;
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;
this.getVehicleDetails();
} else {
this.imageUrl = null;
}
@ -318,6 +312,20 @@ export default {
arePagePrerequisitesValid() {
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() {
this.dispatchStoreAction(