Refactor changes

This commit is contained in:
Sneha 2023-09-26 17:48:44 +05:30
parent 92b62768f1
commit 7d365962d4

View file

@ -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(