From e9258553c64390e23c24fd1e2c5216080755c109 Mon Sep 17 00:00:00 2001 From: Sanskar Soni Date: Wed, 6 Sep 2023 16:38:26 +0530 Subject: [PATCH] Improved: how states should be accessed in component (#126) --- src/components/MenuFooterNavigation.vue | 43 +++++++++++-------------- 1 file changed, 19 insertions(+), 24 deletions(-) diff --git a/src/components/MenuFooterNavigation.vue b/src/components/MenuFooterNavigation.vue index ad1e13c..bb9a594 100644 --- a/src/components/MenuFooterNavigation.vue +++ b/src/components/MenuFooterNavigation.vue @@ -4,32 +4,32 @@ -

{{ instanceUrl }}

+

{{ appUserState.instanceUrl }}

- {{ userProfile?.userTimeZone }} + {{ appUserState.userProfile?.userTimeZone }}
- - - {{ store.storeName }} + + + {{ store.storeName }} - {{ currentEComStore.storeName }} + {{ appUserState.currentEComStore.storeName }} - - - {{ shopifyConfig.name ? shopifyConfig.name : shopifyConfig.shopifyConfigName }} + + + {{ shopifyConfig.name ? shopifyConfig.name : shopifyConfig.shopifyConfigName }} -

{{ currentShopifyConfig.name ? currentShopifyConfig.name : currentShopifyConfig.shopifyConfigName }}

+

{{ appUserState.currentShopifyConfig.name ? appUserState.currentShopifyConfig.name : appUserState.currentShopifyConfig.shopifyConfigName }}

@@ -41,20 +41,15 @@ import { IonFooter, IonItem, IonLabel, IonNote, IonSelect, IonSelectOption, IonT import { appContext } from "../index"; import { computed } from 'vue'; -const instanceUrl = computed(() => { - return appContext.config.globalProperties.$store.getters['user/getInstanceUrl']; -}); -const userProfile = computed(() => { - return appContext.config.globalProperties.$store.getters['user/getUserProfile']; -}); -const currentEComStore = computed(() => { - return appContext.config.globalProperties.$store.getters['user/getCurrentEComStore']; -}); -const shopifyConfigs = computed(() => { - return appContext.config.globalProperties.$store.getters['user/getShopifyConfigs']; -}); -const currentShopifyConfig = computed(() => { - return appContext.config.globalProperties.$store.getters['user/getCurrentShopifyConfig']; +const store = appContext.config.globalProperties.$store; +const appUserState = computed(() => { + return { + instanceUrl: store.getters['user/getInstanceUrl'], + userProfile: store.getters['user/getUserProfile'], + currentEComStore: store.getters['user/getCurrentEComStore'], + shopifyConfigs: store.getters['user/getShopifyConfigs'], + currentShopifyConfig: store.getters['user/getCurrentShopifyConfig'] + } });