orderiom-api-package 0.4.4 → 0.4.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/modules/product.js +17 -3
package/package.json
CHANGED
package/src/modules/product.js
CHANGED
|
@@ -215,9 +215,11 @@ const actions = {
|
|
|
215
215
|
}
|
|
216
216
|
}).then(res => {
|
|
217
217
|
res.data.data.forEach(productInCategory => {
|
|
218
|
-
|
|
218
|
+
let quantity = 0;
|
|
219
|
+
state.ShoppingCart
|
|
219
220
|
.filter(itemInCart => Number(itemInCart.RestaurantProductId) === Number(productInCategory.id))
|
|
220
|
-
.
|
|
221
|
+
.forEach((item) => quantity += item.quantity);
|
|
222
|
+
productInCategory.quantity = quantity;
|
|
221
223
|
});
|
|
222
224
|
commit("setProduct", res.data.data);
|
|
223
225
|
return { type: 'success', data: res.data.data }
|
|
@@ -331,7 +333,19 @@ const actions = {
|
|
|
331
333
|
return { type: 'error', msg: 'There was an error in updating the delivery type' }
|
|
332
334
|
}
|
|
333
335
|
|
|
334
|
-
|
|
336
|
+
const selectedCategory = rootState.orderiomApiPackage.product.selectedCategory
|
|
337
|
+
if (selectedCategory) {
|
|
338
|
+
dispatch("getProducts", {
|
|
339
|
+
category: selectedCategory,
|
|
340
|
+
restaurantId: restaurantId,
|
|
341
|
+
});
|
|
342
|
+
dispatch("getAttributeItems", {
|
|
343
|
+
category: selectedCategory,
|
|
344
|
+
restaurantId: restaurantId
|
|
345
|
+
});
|
|
346
|
+
} else {
|
|
347
|
+
dispatch('getCategories', (restaurantId || restaurantIdEnv));
|
|
348
|
+
}
|
|
335
349
|
|
|
336
350
|
const result = await dispatch("getBasket", (restaurantId || restaurantIdEnv));
|
|
337
351
|
|