diff --git a/src/store/modules/user/actions.ts b/src/store/modules/user/actions.ts index bfa48e46..047fa600 100644 --- a/src/store/modules/user/actions.ts +++ b/src/store/modules/user/actions.ts @@ -182,7 +182,7 @@ const actions: ActionTree = { /** * update current facility information */ - async setFacility ({ commit, dispatch, state }, payload) { + async setFacility ({ commit, dispatch, state }, facility) { // On slow api response, setFacility takes long to update facility in state. // Hence displaying loader to not allowing user to navigate to orders page to avoid wrong results. emitter.emit('presentLoader', {message: 'Updating facility', backdropDismiss: false}) @@ -190,7 +190,7 @@ const actions: ActionTree = { try { const token = store.getters['user/getUserToken']; const userProfile = JSON.parse(JSON.stringify(state.current as any)); - userProfile.stores = await UserService.getEComStores(token, payload.facility); + userProfile.stores = await UserService.getEComStores(token, facility); let preferredStore = userProfile.stores[0]; const preferredStoreId = await UserService.getPreferredStore(token); @@ -200,7 +200,6 @@ const actions: ActionTree = { store && (preferredStore = store) } commit(types.USER_INFO_UPDATED, userProfile); - commit(types.USER_CURRENT_FACILITY_UPDATED, payload.facility); commit(types.USER_CURRENT_ECOM_STORE_UPDATED, preferredStore); this.dispatch('order/clearOrders') await dispatch('getDisableShipNowConfig') diff --git a/src/store/modules/user/mutation-types.ts b/src/store/modules/user/mutation-types.ts index 006adf78..4b6861d0 100644 --- a/src/store/modules/user/mutation-types.ts +++ b/src/store/modules/user/mutation-types.ts @@ -2,7 +2,6 @@ export const SN_USER = 'user' export const USER_TOKEN_CHANGED = SN_USER + '/TOKEN_CHANGED' export const USER_END_SESSION = SN_USER + '/END_SESSION' export const USER_INFO_UPDATED = SN_USER + '/INFO_UPDATED' -export const USER_CURRENT_FACILITY_UPDATED = SN_USER + '/CURRENT_FACILITY_UPDATED' export const USER_INSTANCE_URL_UPDATED = SN_USER + '/INSTANCE_URL_UPDATED' export const USER_CURRENT_ECOM_STORE_UPDATED = SN_USER + '/CURRENT_ECOM_STORE_UPDATED' export const USER_PREFERENCE_UPDATED = SN_USER + '/PREFERENCE_UPDATED' diff --git a/src/views/Settings.vue b/src/views/Settings.vue index e915f861..eccc6045 100644 --- a/src/views/Settings.vue +++ b/src/views/Settings.vue @@ -38,7 +38,7 @@
- + @@ -452,9 +452,9 @@ export default defineComponent({ this.updateOrderLimitType() } }, - async updateFacility() { + async updateFacility(facility: any) { + await this.store.dispatch('user/setFacility', facility); await this.store.dispatch('user/fetchNotificationPreferences') - this.store.dispatch('order/clearOrders') this.getCurrentFacilityDetails(); this.getFacilityOrderCount(); this.getEcomInvStatus();