orderiom-api-package 0.3.6 → 0.3.8
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 +3 -3
- package/src/modules/product.js +2 -0
package/package.json
CHANGED
package/src/common.js
CHANGED
|
@@ -31,7 +31,7 @@ export function calculateBasketIdParameter(isLogin, restaurantId) {
|
|
|
31
31
|
console.error(e);
|
|
32
32
|
throw new Error('Basket not found');
|
|
33
33
|
}
|
|
34
|
-
const foundBasket = baskets.find(basket => Number(basket.restaurantId) === (restaurantId || restaurantIdEnv));
|
|
34
|
+
const foundBasket = baskets.find(basket => Number(basket.restaurantId) === (Number(restaurantId) || restaurantIdEnv));
|
|
35
35
|
if(!foundBasket){
|
|
36
36
|
throw new Error('Basket not found');
|
|
37
37
|
}
|
|
@@ -58,7 +58,7 @@ export function updateBasket({commit, basketId, res, isOutsideProduct, restauran
|
|
|
58
58
|
|
|
59
59
|
if (parseInt(basketInfo.id) !== parseInt(basketId)) {
|
|
60
60
|
const baskets = JSON.parse(localStorage.getItem('basket'));
|
|
61
|
-
const basketIndex = baskets.findIndex(basket => parseInt(basket.restaurantId) === (restaurantId || restaurantIdEnv));
|
|
61
|
+
const basketIndex = baskets.findIndex(basket => parseInt(basket.restaurantId) === (Number(restaurantId) || restaurantIdEnv));
|
|
62
62
|
if (basketIndex > -1) baskets.splice(basketIndex, 1);
|
|
63
63
|
baskets.push({
|
|
64
64
|
restaurantId: (restaurantId || restaurantIdEnv),
|
|
@@ -69,4 +69,4 @@ export function updateBasket({commit, basketId, res, isOutsideProduct, restauran
|
|
|
69
69
|
|
|
70
70
|
commit(`${isOutsideProduct ? 'product/' : ''}basketLoadedOnce`);
|
|
71
71
|
return true;
|
|
72
|
-
}
|
|
72
|
+
}
|
package/src/modules/product.js
CHANGED
|
@@ -258,6 +258,8 @@ const actions = {
|
|
|
258
258
|
);
|
|
259
259
|
},
|
|
260
260
|
getBasket({ commit, rootState }, data) {
|
|
261
|
+
if(typeof data === 'string' || typeof data === 'number') data = {restaurantId: data};
|
|
262
|
+
|
|
261
263
|
let basketId = undefined;
|
|
262
264
|
try{
|
|
263
265
|
basketId = calculateBasketIdParameter(!!rootState.orderiomApiPackage.auth.privateToken, data ? data.restaurantId : undefined);
|