orderiom-api-package 0.4.10 → 0.4.12
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/common.js +1 -1
- package/src/modules/order.js +16 -17
- package/src/modules/product.js +3 -5
package/package.json
CHANGED
package/src/common.js
CHANGED
|
@@ -37,7 +37,7 @@ export function calculateBasketIdParameter(isLogin, restaurantId) {
|
|
|
37
37
|
console.error(e);
|
|
38
38
|
throw new Error('Basket not found');
|
|
39
39
|
}
|
|
40
|
-
const foundBasket = baskets.
|
|
40
|
+
const foundBasket = baskets.findLast(basket => Number(basket.restaurantId) === (Number(restaurantId) || restaurantIdEnv));
|
|
41
41
|
if(!foundBasket){
|
|
42
42
|
throw new Error('Basket not found');
|
|
43
43
|
}
|
package/src/modules/order.js
CHANGED
|
@@ -593,6 +593,22 @@ const actions = {
|
|
|
593
593
|
// commit('setorder', res.data.data.order)
|
|
594
594
|
// commit('setuserOrder', JSON.parse(res.data.data.order.user_details));
|
|
595
595
|
// commit('setshippigPriceOrder', res.data.data.order.shipping_price);
|
|
596
|
+
const basketData = JSON.parse(localStorage.getItem("basket"));
|
|
597
|
+
if (basketData) {
|
|
598
|
+
const index = basketId
|
|
599
|
+
? basketData.findIndex(item => Number(item.basketId) === Number(basketId))
|
|
600
|
+
: basketData.findIndex(item => Number(item.restaurantId) === Number(data.restaurantId || restaurantIdEnv))
|
|
601
|
+
if (index > -1) {
|
|
602
|
+
basketData.splice(index, 1);
|
|
603
|
+
localStorage.setItem("basket", JSON.stringify(basketData));
|
|
604
|
+
}
|
|
605
|
+
}
|
|
606
|
+
|
|
607
|
+
commit("product/SetSubtotalPrice", "0.00", {root: true});
|
|
608
|
+
commit("product/SetShoppingCart", [], {root: true});
|
|
609
|
+
commit("product/setBasketInfo", {}, {root: true});
|
|
610
|
+
commit("product/setDeliveryTime", "", {root: true});
|
|
611
|
+
commit("product/SetTotalPrice", "0.00", { root: true });
|
|
596
612
|
|
|
597
613
|
if (
|
|
598
614
|
(
|
|
@@ -618,23 +634,6 @@ const actions = {
|
|
|
618
634
|
window.location = res.data.data.paymentLink;
|
|
619
635
|
}
|
|
620
636
|
|
|
621
|
-
const basketData = JSON.parse(localStorage.getItem("basket"));
|
|
622
|
-
if (basketData) {
|
|
623
|
-
const index = basketId
|
|
624
|
-
? basketData.findIndex(item => Number(item.basketId) === Number(basketId))
|
|
625
|
-
: basketData.findIndex(item => Number(item.restaurantId) === Number(data.restaurantId || restaurantIdEnv))
|
|
626
|
-
if (index > -1) {
|
|
627
|
-
basketData.splice(index, 1);
|
|
628
|
-
localStorage.setItem("basket", JSON.stringify(basketData));
|
|
629
|
-
}
|
|
630
|
-
}
|
|
631
|
-
|
|
632
|
-
commit("product/SetSubtotalPrice", "0.00", {root: true});
|
|
633
|
-
commit("product/SetShoppingCart", [], {root: true});
|
|
634
|
-
commit("product/setBasketInfo", {}, {root: true});
|
|
635
|
-
commit("product/setDeliveryTime", "", {root: true});
|
|
636
|
-
commit("product/SetTotalPrice", "0.00", { root: true });
|
|
637
|
-
|
|
638
637
|
return {
|
|
639
638
|
type: "success",
|
|
640
639
|
msg: "ok",
|
package/src/modules/product.js
CHANGED
|
@@ -390,7 +390,9 @@ const actions = {
|
|
|
390
390
|
}
|
|
391
391
|
|
|
392
392
|
const selectedCategory = rootState.orderiomApiPackage.product.selectedCategory
|
|
393
|
-
if (
|
|
393
|
+
if (rootState.orderiomApiPackage.product.showPinnedProducts) {
|
|
394
|
+
dispatch("getPinnedProducts", restaurantId);
|
|
395
|
+
} else if (selectedCategory) {
|
|
394
396
|
dispatch("getProducts", {
|
|
395
397
|
category: selectedCategory,
|
|
396
398
|
restaurantId: restaurantId,
|
|
@@ -403,10 +405,6 @@ const actions = {
|
|
|
403
405
|
dispatch('getCategories', (restaurantId || restaurantIdEnv));
|
|
404
406
|
}
|
|
405
407
|
|
|
406
|
-
if (rootState.orderiomApiPackage.product.showPinnedProducts) {
|
|
407
|
-
dispatch("getPinnedProducts", restaurantId);
|
|
408
|
-
}
|
|
409
|
-
|
|
410
408
|
const result = await dispatch("getBasket", (restaurantId || restaurantIdEnv));
|
|
411
409
|
|
|
412
410
|
return {
|