diff --git a/src/layouts/vehicle/vehicle.vue b/src/layouts/vehicle/vehicle.vue index 97c66c3bf..494027bb9 100644 --- a/src/layouts/vehicle/vehicle.vue +++ b/src/layouts/vehicle/vehicle.vue @@ -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(