Skip to content

Commit

Permalink
Improved: support for matching of products for the identifiers not in…
Browse files Browse the repository at this point in the history
… goodIdentifications (#606)
  • Loading branch information
amansinghbais committed Jan 15, 2025
1 parent cacf16a commit 6dcf957
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/store/modules/product/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,13 +73,15 @@ const actions: ActionTree<ProductState, RootState> = {
async fetchProductByIdentification ( { commit, state }, payload) {
const cachedProductIds = Object.keys(state.cached);
if(cachedProductIds.includes(payload.scannedValue)) return;
const productIdentifications = JSON.parse(JSON.stringify(process.env.VUE_APP_PRDT_IDENT))

const productStoreSettings = store.getters["user/getProductStoreSettings"];
const barcodeIdentification = productStoreSettings["barcodeIdentificationPref"]
let resp;

try {
resp = await ProductService.fetchProducts({
"filters": [`goodIdentifications: ${productStoreSettings["barcodeIdentificationPref"]}/${payload.scannedValue}`],
"filters": [productIdentifications.includes(barcodeIdentification) ? `${barcodeIdentification}: ${payload.scannedValue}` : `goodIdentifications: ${barcodeIdentification}/${payload.scannedValue}`],
"viewSize": 1
})
if(resp.status === 200 && !hasError(resp)) {
Expand Down

0 comments on commit 6dcf957

Please sign in to comment.