Skip to content

Commit

Permalink
Merge pull request #930 from R-Sourabh/facility-change-settings-fix
Browse files Browse the repository at this point in the history
Improved: On updating the facility, the settings related to the facility are also being updated(bopis-500)
  • Loading branch information
ymaheshwari1 authored Feb 3, 2025
2 parents b62e367 + df0593d commit 836bbf2
Showing 1 changed file with 18 additions and 6 deletions.
24 changes: 18 additions & 6 deletions src/store/modules/user/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -182,17 +182,25 @@ const actions: ActionTree<UserState, RootState> = {
emitter.emit('presentLoader', {message: 'Updating facility', backdropDismiss: false})

try {
const previousEComStoreId = getProductStoreId()
const userProfile = JSON.parse(JSON.stringify(state.current as any));
userProfile.stores = await useUserStore().getEComStoresByFacility(facility.facilityId);
await useUserStore().getEComStorePreference('SELECTED_BRAND');
const preferredStore: any = useUserStore().getCurrentEComStore

commit(types.USER_INFO_UPDATED, userProfile);
this.dispatch('order/clearOrders')
await dispatch('getDisableShipNowConfig')
await dispatch('getDisableUnpackConfig')
this.dispatch('util/getForceScanSetting', preferredStore.productStoreId)
this.dispatch('util/fetchBarcodeIdentificationPref', preferredStore.productStoreId);

if(previousEComStoreId !== preferredStore.productStoreId) {
this.dispatch('order/clearOrders')
await dispatch('getDisableShipNowConfig')
await dispatch('getDisableUnpackConfig')
await dispatch('getNewRejectionApiConfig')
await dispatch('getPartialOrderRejectionConfig')
await dispatch('getCollateralRejectionConfig')
await dispatch('getAffectQohConfig')
this.dispatch('util/findProductStoreShipmentMethCount');
this.dispatch('util/getForceScanSetting', preferredStore.productStoreId)
this.dispatch('util/fetchBarcodeIdentificationPref', preferredStore.productStoreId);
}
} catch(error: any) {
logger.error(error);
showToast(error?.message ? error.message : translate("Something went wrong"))
Expand Down Expand Up @@ -226,6 +234,10 @@ const actions: ActionTree<UserState, RootState> = {

await dispatch('getDisableShipNowConfig')
await dispatch('getDisableUnpackConfig')
await dispatch('getNewRejectionApiConfig')
await dispatch('getPartialOrderRejectionConfig')
await dispatch('getCollateralRejectionConfig')
await dispatch('getAffectQohConfig')
this.dispatch('util/findProductStoreShipmentMethCount');
this.dispatch('util/getForceScanSetting', productStoreId)
this.dispatch('util/fetchBarcodeIdentificationPref', productStoreId);
Expand Down

0 comments on commit 836bbf2

Please sign in to comment.