code review changes

This commit is contained in:
Kulbhushan Kaushik 2022-09-21 08:00:24 -04:00
parent bc473d5e03
commit 70c46a8cd5
5 changed files with 13 additions and 23 deletions

View file

@ -27,7 +27,7 @@ const storeActions = {
VALIDATE_ZIP: "validateZip",
CLEAR_VIN: "clearVin",
// VEHICLE MUTATIONS
// VEHICLE Actions
UPDATE_YEAR: "updateYear",
UPDATE_MAKE: "updateMake",
UPDATE_MODEL: "updateModel",
@ -40,13 +40,6 @@ const storeActions = {
UPDATE_VEHICLE_VIN: "updateVehicleVin",
UPDATE_VEHICLE: "updateVehicle",
UPDATE_LAST_PAGE_VISITED: "updateLastPageVisited",
// DEPENDENCY MUTATIONS
// SAVE COMPONENT STATE
};
export { storeActions };

View file

@ -8,7 +8,6 @@
</template>
<script>
import { issStore } from "@/store/index";
import { storeActions } from "@/constants/store-actions";
export default {
name: 'vehicle-make',

View file

@ -4,14 +4,13 @@ import App from './App.vue';
import router from './router';
import "../node_modules/bootstrap/dist/js/bootstrap.js";
import piniaPluginPersistedstate from 'pinia-plugin-persistedstate';
import { issStore } from './store';
import { useMainStore } from './store';
const vueApp = createApp(App);
const pinia = createPinia();
pinia.use(piniaPluginPersistedstate);
vueApp.use(pinia);
const store = issStore();
vueApp.config.globalProperties.$store = store;
vueApp.config.globalProperties.$store = useMainStore();
vueApp.use(router);
vueApp.mount("#app");

View file

@ -2,7 +2,6 @@ import { createWebHistory, createRouter } from "vue-router";
import { lazyLoadComponent } from "./dynamic-routing/component-loader";
import { endpoints } from "../constants/mock-endpoints";
import globalMethods from "@/global-methods";
import { storeActions } from "../constants/store-actions";
const routes = [
{

View file

@ -3,8 +3,8 @@ import { endpoints } from "@/constants/endpoints.js";
import globalMethods from "@/global-methods";
import { storeActions } from "@/constants/store-actions";
export const issStore = defineStore({
id: 'issStore',
export const useMainStore = defineStore({
id: 'main',
state() {
return {
order: {
@ -66,20 +66,20 @@ export const issStore = defineStore({
getters: {},
actions:
{
updateYear(state, year) {
state.order.vehicle.year = year;
updateYear(year) {
this.order.vehicle.year = year;
},
updateMake(state, make) {
state.order.vehicle.make = make;
updateMake(make) {
this.order.vehicle.make = make;
},
updateModel(state, model) {
state.order.vehicle.model = model;
updateModel(model) {
this.order.vehicle.model = model;
},
// Vehicle
saveVehicleYear(year)
{
if (this.$state.order.vehicle.year !== year) {
this.updateYear(this.$state,year);
if (this.order.vehicle.year !== year) {
this.updateYear(year);
}
},
},