all scenarios besides 1B

This commit is contained in:
Katie Kroell 2023-06-07 16:19:04 -04:00
parent b4f3117f41
commit 042a732d04

View file

@ -155,22 +155,6 @@ export default {
const vehicle = this.mainStore.lookupVehicleByVin(this.selectedVehicleVin); const vehicle = this.mainStore.lookupVehicleByVin(this.selectedVehicleVin);
return vehicle; return vehicle;
}, },
//displayGeneric() {
// const selectedVehicle = useMainStore().lookupVehicleByVin(this.selectedVehicleVin);
// const styleOptions = this.mainStore.getVehicleStyles(
// selectedVehicle.year,
// selectedVehicle.make,
// selectedVehicle.model,
// );
// const styleOptions = this.selectedVehicle.style;
// if (styleOptions.length > 1) {
// return true;
// }
// return false;
//}
}, },
watch: { watch: {
async selectedVehicleVin(value) { async selectedVehicleVin(value) {
@ -183,19 +167,30 @@ export default {
else { else {
// get vehicle details from selected vin // get vehicle details from selected vin
const vehicle = await this.lookupVehicleByVin(value); const vehicle = await this.lookupVehicleByVin(value);
if (vehicle.error) {
this.mainStore.resetVehicleState();
this.displayGeneric = true;
}
// save selected vehicle to the store // save selected vehicle to the store
this.mainStore.updateVehicle(vehicle.data); this.mainStore.updateVehicle(vehicle.data);
this.displayGeneric = false; this.displayGeneric = true;
const styleOptions = await this.mainStore.getVehicleStyles( const styleOptions = await this.mainStore.getVehicleStyles(
vehicle.data.year, vehicle.data.year,
vehicle.data.make, vehicle.data.make,
vehicle.data.model vehicle.data.model
) )
// if there is more than 1 style for the selected vehicle, display blurred image
if (styleOptions.length > 1) { // if there is more than 1 style for the selected vehicle, display generic/blurred image
if (styleOptions.data.length > 1) {
this.displayGeneric = true; this.displayGeneric = true;
} }
else {
// display clear image of vehicle
this.displayGeneric = false;
}
} }
} }
}, },