This commit is contained in:
Kulbhushan Kaushik 2022-10-11 10:27:37 -04:00
parent afd9e8b91e
commit f22f42c260
6 changed files with 29 additions and 14 deletions

View file

@ -3,6 +3,9 @@
<div class="fade-on-route-transition"> <div class="fade-on-route-transition">
<navButton type="button" text="back" :scenario="this.navigationScenarios.CLICKED_BACK"></navButton> <navButton type="button" text="back" :scenario="this.navigationScenarios.CLICKED_BACK"></navButton>
<p>Vehicle Year Placeholder</p> <p>Vehicle Year Placeholder</p>
<input type="text" v-model="year"/>
<span>{{returnVehicleYear}}</span>
<button @click="updateVehicleYear(year)">Add</button>
</div> </div>
</div> </div>
</template> </template>
@ -13,5 +16,19 @@
export default { export default {
name: 'vehicle-year', name: 'vehicle-year',
components: { navButton }, components: { navButton },
methods:
{
updateVehicleYear(item)
{
this.mainStore.updateVehicleYear(item);
}
},
computed:
{
returnVehicleYear()
{
return this.mainStore.order.vehicle.year;
}
}
} }
</script> </script>

View file

@ -1,18 +1,16 @@
import { createApp } from 'vue'; import { createApp } from 'vue';
import { createPinia } from "pinia";
import App from './App.vue'; 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 { useMainStore } from './store'; import { useMainStore, pinia } from '@/store';
import baseMixin from "@/mixins/base-mixin.js"; import baseMixin from "@/mixins/base-mixin.js";
const vueApp = createApp(App); const vueApp = createApp(App);
// Pinia // Pinia
const pinia = createPinia();
pinia.use(piniaPluginPersistedstate);
vueApp.use(pinia); vueApp.use(pinia);
pinia.use(piniaPluginPersistedstate);
useMainStore().populateInitialState(); useMainStore().populateInitialState();
// Additional Vue items to setup // Additional Vue items to setup

View file

@ -3,10 +3,9 @@ import { navigationScenarios } from "@/router/router-constants/navigation-scenar
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";
import { dynamicStrings } from "@/constants/dynamic-strings"; import { dynamicStrings } from "@/constants/dynamic-strings";
import { useMainStore } from "../store"; import { useMainStore } from "@/store";
import { mapStores } from "pinia"; import { mapStores } from "pinia";
export default { export default {
data() { data() {
return { return {

View file

@ -3,6 +3,7 @@ import { lazyLoadComponent } from "@/router/dynamic-routing/component-loader";
import {issPageValues} from '@/router/router-constants/issPage-values'; import {issPageValues} from '@/router/router-constants/issPage-values';
import { routingTable } from "@/router/router-constants/routing-table"; import { routingTable } from "@/router/router-constants/routing-table";
import { useMainStore } from '@/store'; import { useMainStore } from '@/store';
import { pinia } from "../store";
const routes = [ const routes = [
{ {
@ -54,7 +55,7 @@ const router = createRouter({
// Get route information by page name. // Get route information by page name.
// This will reach out to the Cms and there is a 1:1 relationship between page names and route names. // This will reach out to the Cms and there is a 1:1 relationship between page names and route names.
async function GetRouteInfoFromPageName(pageName) { async function GetRouteInfoFromPageName(pageName) {
const response = await this.mainStore.getRouteInfo(pageName); const response = await useMainStore(pinia).getRouteInfo(pageName);
const jsonFromResponse = JSON.parse(response.data.Result); const jsonFromResponse = JSON.parse(response.data.Result);
let routeData = []; let routeData = [];
@ -122,7 +123,7 @@ function navigateToUrl(url, optionalQuery = {}) {
function getNavigationMap (scenario, currentRoute) { function getNavigationMap (scenario, currentRoute) {
const issPageValue = currentRoute.query.issPage; const issPageValue = currentRoute.query.issPage;
try { try {
const matchedQueryValue = routingTable(useMainStore()) const matchedQueryValue = routingTable(useMainStore(pinia))
.filter( .filter(
(item) => (item) =>
item.issPageValue === issPageValue && item.issPageValue === issPageValue &&

View file

@ -1,4 +1,4 @@
import { defineStore } from "pinia"; import { defineStore, createPinia } from "pinia";
import { endpoints } from "@/constants/endpoints.js"; import { endpoints } from "@/constants/endpoints.js";
import globalMethods from "@/global-methods"; import globalMethods from "@/global-methods";
import { applicationConfig } from "@/constants/application-config"; import { applicationConfig } from "@/constants/application-config";
@ -51,7 +51,7 @@ export const useMainStore = defineStore({
actions: actions:
{ {
// Content API Actions // Content API Actions
getRouteInfo(context, { pageName }) { getRouteInfo(pageName) {
return globalMethods.callHttpClient({ return globalMethods.callHttpClient({
method: endpoints.GetRouteInfo.method, method: endpoints.GetRouteInfo.method,
endpoint: endpoints.GetRouteInfo.url(applicationConfig.APPLICATION_ABBREVIATION), endpoint: endpoints.GetRouteInfo.url(applicationConfig.APPLICATION_ABBREVIATION),
@ -60,13 +60,13 @@ export const useMainStore = defineStore({
}, },
}); });
}, },
getHomepageName(context) { getHomepageName() {
return globalMethods.callHttpClient({ return globalMethods.callHttpClient({
method: endpoints.GetHomepageInfo.method, method: endpoints.GetHomepageInfo.method,
endpoint: endpoints.GetHomepageInfo.url(applicationConfig.APPLICATION_ABBREVIATION), endpoint: endpoints.GetHomepageInfo.url(applicationConfig.APPLICATION_ABBREVIATION),
}); });
}, },
getPageData(context, { pageName }) { getPageData(pageName) {
return globalMethods.callHttpClient({ return globalMethods.callHttpClient({
method: endpoints.GetPageData.method, method: endpoints.GetPageData.method,
endpoint: endpoints.GetPageData.url(applicationConfig.APPLICATION_ABBREVIATION, pageName), endpoint: endpoints.GetPageData.url(applicationConfig.APPLICATION_ABBREVIATION, pageName),
@ -93,4 +93,4 @@ export const useMainStore = defineStore({
persist: true persist: true
}); });
export const pinia = createPinia();

View file

@ -1,4 +1,4 @@
process.env.VUE_APP_CONSUMER_CF_DISTRO ="https://digitalapi.dev.sagaws.net"; process.env.VUE_APP_CONSUMER_CF_DISTRO ="https://digitalapi.dev.safelite.io";
process.env.VUE_APP_CURRENT_ENVIRONMENT = "Localhost"; process.env.VUE_APP_CURRENT_ENVIRONMENT = "Localhost";
module.exports = { module.exports = {