Put the store update methods back on the vehicle vue components.
This commit is contained in:
parent
7bc6458449
commit
b019bd556e
6 changed files with 36 additions and 6 deletions
|
|
@ -91,7 +91,7 @@
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
selectedMake(make) {
|
selectedMake(make) {
|
||||||
this.mainStore.order.vehicle.make = make;
|
this.mainStore.updateVehicleMake(make);
|
||||||
this.$router.navigate(
|
this.$router.navigate(
|
||||||
this.navigationScenarios.SELECTED_MAKE,
|
this.navigationScenarios.SELECTED_MAKE,
|
||||||
this.$route
|
this.$route
|
||||||
|
|
|
||||||
|
|
@ -84,7 +84,7 @@
|
||||||
|
|
||||||
watch: {
|
watch: {
|
||||||
selectedModel(model) {
|
selectedModel(model) {
|
||||||
this.mainStore.order.vehicle.model = model;
|
this.mainStore.updateVehicleModel(model);
|
||||||
this.$router.navigate(
|
this.$router.navigate(
|
||||||
this.navigationScenarios.SELECTED_MODEL,
|
this.navigationScenarios.SELECTED_MODEL,
|
||||||
this.$route
|
this.$route
|
||||||
|
|
|
||||||
|
|
@ -78,7 +78,7 @@ export default {
|
||||||
|
|
||||||
watch: {
|
watch: {
|
||||||
selectedStyle(style) {
|
selectedStyle(style) {
|
||||||
this.mainStore.order.vehicle.style = style;
|
this.mainStore.updateVehicleStyle(style);
|
||||||
this.$router.navigate(
|
this.$router.navigate(
|
||||||
this.navigationScenarios.SELECTED_STYLE,
|
this.navigationScenarios.SELECTED_STYLE,
|
||||||
this.$route
|
this.$route
|
||||||
|
|
|
||||||
|
|
@ -70,7 +70,7 @@
|
||||||
watch: {
|
watch: {
|
||||||
selectedYear(year) {
|
selectedYear(year) {
|
||||||
const parsedYear = parseInt(year);
|
const parsedYear = parseInt(year);
|
||||||
this.mainStore.order.vehicle.year = parsedYear;
|
this.mainStore.updateVehicleYear(parsedYear);
|
||||||
this.$router.navigate(
|
this.$router.navigate(
|
||||||
this.navigationScenarios.SELECTED_YEAR,
|
this.navigationScenarios.SELECTED_YEAR,
|
||||||
this.$route
|
this.$route
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
|
|
||||||
import { mapStores } from "pinia";
|
import { mapStores } from "pinia";
|
||||||
import { useMainStore } from "@/store";
|
import { useMainStore } from "@/store";
|
||||||
|
;
|
||||||
import { navigationScenarios } from "@/router/router-constants/navigation-scenarios";
|
import { navigationScenarios } from "@/router/router-constants/navigation-scenarios";
|
||||||
import { vehicleCategories } from "@/constants/vehicle-categories.js";
|
import { vehicleCategories } from "@/constants/vehicle-categories.js";
|
||||||
import { queryStrings } from "@/constants/query-strings";
|
import { queryStrings } from "@/constants/query-strings";
|
||||||
|
|
|
||||||
|
|
@ -189,6 +189,35 @@ export const useMainStore = defineStore({
|
||||||
payload: {},
|
payload: {},
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
// Vehicle API Actions
|
||||||
|
updateVehicleYear(year)
|
||||||
|
{
|
||||||
|
if (this.order.vehicle.year !== year) {
|
||||||
|
this.order.vehicle.year = year;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
updateVehicleMake(make)
|
||||||
|
{
|
||||||
|
if (this.order.vehicle.make !== make) {
|
||||||
|
this.order.vehicle.make = make;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
updateVehicleModel(model)
|
||||||
|
{
|
||||||
|
if (this.order.vehicle.model !== model) {
|
||||||
|
this.order.vehicle.model = model;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
updateVehicleStyle(style)
|
||||||
|
{
|
||||||
|
if (this.order.vehicle.style !== style) {
|
||||||
|
this.order.vehicle.style = style;
|
||||||
|
}
|
||||||
|
},
|
||||||
addEventToBus (event) {
|
addEventToBus (event) {
|
||||||
this.applicationUser.eventBus.push(event);
|
this.applicationUser.eventBus.push(event);
|
||||||
},
|
},
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue