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]; const sameStyle = this.selectedStyle === this.styleOptions[0];
this.selectedStyle = this.styleOptions[0]; this.selectedStyle = this.styleOptions[0];
if (sameStyle) { if (sameStyle) {
this.carId = null; this.getCarID();
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;
} }
} else this.selectedStyle = null; } else this.selectedStyle = null;
} else { } else {
@ -289,18 +278,7 @@ export default {
}, },
async selectedStyle(style) { async selectedStyle(style) {
if (style) { if (style) {
this.carId = null; this.getCarID();
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;
} }
@ -334,6 +312,20 @@ export default {
arePagePrerequisitesValid() { arePagePrerequisitesValid() {
return true; 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() { async forwardButtonAction() {
this.dispatchStoreAction( this.dispatchStoreAction(