diff --git a/src/layouts/policy-vehicles/policy-vehicles.vue b/src/layouts/policy-vehicles/policy-vehicles.vue index b23ee186..b12d2b5c 100644 --- a/src/layouts/policy-vehicles/policy-vehicles.vue +++ b/src/layouts/policy-vehicles/policy-vehicles.vue @@ -55,7 +55,7 @@ import { deductibleForSelectedVehicle, endorsementsForSelectedVehicle, noCoverageForSelectedVehicle, - repairWaivedForSelectedVehicle, + repairWaivedForSelectedVehicle } from '@/helpers/policy-vehicle-helper'; export default { @@ -66,13 +66,11 @@ export default { vehicleBanner, policyVehiclesQuestion, // eslint-disable-next-line vue/no-reserved-component-names - Form, + Form }, mixins: [BaseFormMixin], async beforeRouteEnter(to, from, next) { - const cmsContentPromise = await fetchCmsContentForPage( - to.query.issPage - ); + const cmsContentPromise = await fetchCmsContentForPage(to.query.issPage); next((vm) => { vm.setCmsContent(cmsContentPromise); }); @@ -90,8 +88,8 @@ export default { displayGeneric: true, policyVinFound: true, rules: { - optionRequired: globalRules.OPTION_REQUIRED, - }, + optionRequired: globalRules.OPTION_REQUIRED + } }; }, computed: { @@ -108,7 +106,7 @@ export default { vehicle: v, Text: `${v.vehicleYear} ${v.vehicleMake} ${v.vehicleModel}`, Name: v.vin, - SubText: `VIN ${vinStart}${vinEnd}`, + SubText: `VIN ${vinStart}${vinEnd}` }; }) ?? []; return mappedData; @@ -126,11 +124,9 @@ export default { return repairWaivedForSelectedVehicle(this.selectedPolicyVehicle); }, selectedVehicle() { - const vehicle = this.mainStore.lookupVehicleByVin( - this.selectedVehicleVin - ); + const vehicle = this.mainStore.lookupVehicleByVin(this.selectedVehicleVin); return vehicle; - }, + } }, watch: { async selectedVehicleVin(value) { @@ -154,12 +150,10 @@ export default { // save selected vehicle to the store this.mainStore.updateVehicle(vehicle.data); this.displayGeneric = false; - this.selectedPolicyVehicle = this.policyVehicles.find( - (p) => p.vin === value - ); + this.selectedPolicyVehicle = this.policyVehicles.find((p) => p.vin === value); } } - }, + } }, beforeMount() { if (this.mainStore.order.vehicle.vin) { @@ -177,16 +171,9 @@ export default { ); }, async forwardButtonAction() { - if ( - this.selectedVehicleVin !== - vehicleSelectionOptions.VEHICLE_NOT_LISTED - ) { - const vehicleLookupResponse = await this.lookupVehicleByVin( - this.selectedVehicleVin - ); - const vehicle = this.policyVehicles.find( - (pv) => pv.vin === this.selectedVehicleVin - ); + if (this.selectedVehicleVin !== vehicleSelectionOptions.VEHICLE_NOT_LISTED) { + const vehicleLookupResponse = await this.lookupVehicleByVin(this.selectedVehicleVin); + const vehicle = this.policyVehicles.find((pv) => pv.vin === this.selectedVehicleVin); if (vehicleLookupResponse.error) { if (vehicleLookupResponse.status === 404) { @@ -202,18 +189,16 @@ export default { vin: vehicle.vin, noCoverage: this.noCoverageForSelectedVehicle, deductible: this.deductibleForSelectedVehicle, - repairWaived: this.repairWaivedForSelectedVehicle, + repairWaived: this.repairWaivedForSelectedVehicle }); this.policyVinFound = false; return this.navigateForward(); } - this.mainStore.setBailout( - bailoutMessage.vehicleLookupError( - vehicle.vin, - vehicleLookupResponse.data - ) - ); + this.mainStore.setBailout(bailoutMessage.vehicleLookupError( + vehicle.vin, + vehicleLookupResponse.data + )); return this.navigateForward(); } @@ -225,7 +210,7 @@ export default { noCoverage: this.noCoverageForSelectedVehicle, deductible: this.deductibleForSelectedVehicle, repairWaived: this.repairWaivedForSelectedVehicle, - endorsements: this.endorsementsForSelectedVehicle, + endorsements: this.endorsementsForSelectedVehicle } ); @@ -241,24 +226,16 @@ export default { {}, {} ); - } else if ( - this.selectedVehicleVin === - vehicleSelectionOptions.VEHICLE_NOT_LISTED - ) { + } else if (this.selectedVehicleVin === vehicleSelectionOptions.VEHICLE_NOT_LISTED) { this.$router.navigate( this.navigationScenarios.CLICKED_FORWARD_NON_LISTED_VEHICLE, this.$route, {}, {} ); - } else if ( - this.endorsementsForSelectedVehicle?.length > 0 && - (this.endorsementsForSelectedVehicle?.includes( - endorsementOptions.PARKING_GUARD - ) || - this.endorsementsForSelectedVehicle?.includes( - endorsementOptions.EDUCATOR - )) + } else if (this.endorsementsForSelectedVehicle?.length > 0 + && (this.endorsementsForSelectedVehicle?.includes(endorsementOptions.PARKING_GUARD) + || this.endorsementsForSelectedVehicle?.includes(endorsementOptions.EDUCATOR)) ) { this.$router.navigate( this.navigationScenarios.CLICKED_FORWARD_WITH_ENDORSEMENTS, @@ -266,8 +243,7 @@ export default { ); } else if (!this.policyVinFound) { this.$router.navigate( - this.navigationScenarios - .CLICKED_FORWARD_WITH_CAR_ID_NOT_FOUND, + this.navigationScenarios.CLICKED_FORWARD_WITH_CAR_ID_NOT_FOUND, this.$route, {}, {} @@ -288,11 +264,11 @@ export default { return { error: true, status: responseError.status, - data: responseError.data, + data: responseError.data }; } - }, - }, + } + } };