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

View file

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

View file

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

View file

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

View file

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