Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed: Added checks to prevent updating Force Scanning and Bar Identifiers settings when no product store(#436) #438

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 10 additions & 6 deletions src/store/modules/user/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@
/**
* update current eComStore information
*/
async setEComStore({ commit, dispatch }, payload) {

Check warning on line 161 in src/store/modules/user/actions.ts

View workflow job for this annotation

GitHub Actions / call-workflow-in-another-repo / reusable_workflow_job (18.x)

'dispatch' is defined but never used

Check warning on line 161 in src/store/modules/user/actions.ts

View workflow job for this annotation

GitHub Actions / call-workflow-in-another-repo / reusable_workflow_job (20.x)

'dispatch' is defined but never used
commit(types.USER_CURRENT_ECOM_STORE_UPDATED, payload.eComStore);
await UserService.setUserPreference({
'userPrefTypeId': 'SELECTED_BRAND',
Expand All @@ -177,12 +177,16 @@
const previousEComStore = await useUserStore().getCurrentEComStore as any
const eComStore = await UserService.getEComStores(token, facilityId);
await dispatch('getFacilityLocations', facilityId)

if(previousEComStore.productStoreId !== eComStore.productStoreId) {
await useUserStore().setEComStorePreference(eComStore);
commit(types.USER_CURRENT_ECOM_STORE_UPDATED, eComStore);
eComStore?.productStoreId ? this.dispatch('util/getForceScanSetting', eComStore.productStoreId) : this.dispatch('util/updateForceScanStatus', false)
eComStore?.productStoreId ? this.dispatch('util/getBarcodeIdentificationPref', eComStore.productStoreId) : this.dispatch('util/updateBarcodeIdentificationPref', "internalName")
// Initialize or update eComStore based on productStoreId changes
if(!Object.keys(eComStore).length) {
useUserStore().currentEComStore = {}
} else {
if(previousEComStore.productStoreId !== eComStore.productStoreId) {
await useUserStore().setEComStorePreference(eComStore);
commit(types.USER_CURRENT_ECOM_STORE_UPDATED, eComStore);
this.dispatch('util/getForceScanSetting', eComStore.productStoreId)
this.dispatch('util/getBarcodeIdentificationPref', eComStore.productStoreId)
}
}
},

Expand Down
10 changes: 10 additions & 0 deletions src/store/modules/util/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,11 @@ const actions: ActionTree<UtilState, RootState> = {
},

async getForceScanSetting({ commit, dispatch }, eComStoreId) {
if(!eComStoreId) {
commit(types.UTIL_FORCE_SCAN_STATUS_UPDATED, "false")
return;
}

const payload = {
"inputFields": {
"productStoreId": eComStoreId,
Expand Down Expand Up @@ -170,6 +175,11 @@ const actions: ActionTree<UtilState, RootState> = {
},

async getBarcodeIdentificationPref({ commit, dispatch }, eComStoreId) {
if(!eComStoreId) {
commit(types.UTIL_BARCODE_IDENTIFICATION_PREF_UPDATED, "internalName")
return;
}

const payload = {
"inputFields": {
"productStoreId": eComStoreId,
Expand Down
Loading