Only clearing vaps and supporting items if new vehicle selected

This commit is contained in:
Jason Wheeler 2023-06-15 15:46:49 -04:00
parent 821f7eebcb
commit eb6f38a667
2 changed files with 7 additions and 5 deletions

View file

@ -233,7 +233,7 @@ export default {
isSelectedGlassAvailableForVehicle: this.isSelectedGlassAvailableForVehicle,
vehicleInfo:
Object.keys(vehicleInfoToCommit).length === 0
? useMainStore().order.vehicle
? null
: vehicleInfoToCommit,
registrationInfo: {
firstName: this.customerQuestions.firstName,

View file

@ -1158,9 +1158,7 @@ export const useMainStore = defineStore({
registrationInfo?.firstName !== this.order.vehicle.registration?.firstName ||
registrationInfo?.lastName !== this.order.vehicle.registration?.lastName
)
{
this.resetRegistrationAndDependencies();
{
if (!isSelectedGlassAvailableForVehicle) {
this.resetDamageState();
this.resetGlassPartsState();
@ -1170,7 +1168,11 @@ export const useMainStore = defineStore({
this.updateRegistration(registrationInfo);
};
this.updateVehicle(vehicleInfo);
if(vehicleInfo)
{
this.updateVehicle(vehicleInfo);
}
},
saveVin({ isSelectedGlassAvailableForVehicle, vehicleInfo }) {
//Reset dependent state when changing