diff --git a/src/layouts/vehicle/vehicle.vue b/src/layouts/vehicle/vehicle.vue index b653588b6..4027c246a 100644 --- a/src/layouts/vehicle/vehicle.vue +++ b/src/layouts/vehicle/vehicle.vue @@ -268,18 +268,7 @@ export default { const sameStyle = this.selectedStyle === this.styleOptions[0]; this.selectedStyle = this.styleOptions[0]; if (sameStyle) { - 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; + this.getCarID(); } } else this.selectedStyle = null; } else { @@ -289,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.getCarID(); } else { this.imageUrl = null; } @@ -334,6 +312,20 @@ export default { arePagePrerequisitesValid() { return true; }, + async getCarID(){ + 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(