orderiom-api-package 0.3.43 → 0.3.44

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "orderiom-api-package",
3
- "version": "0.3.43",
3
+ "version": "0.3.44",
4
4
  "description": "This package will install all necessary API calls for every orderiom restaurant",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -165,11 +165,9 @@ const actions = {
165
165
  .catch(commonErrorCallback());
166
166
  },
167
167
  addToBasket({ dispatch, rootState }, data) {
168
- // might be null
169
- const basketProduct =
170
- rootState.orderiomApiPackage.product.ShoppingCart.find(
171
- (f) => f.basketProductId === Number(data.productId)
172
- );
168
+ const basketProduct = !data.basketProductId
169
+ ? null
170
+ : rootState.orderiomApiPackage.product.ShoppingCart.find(f => f.basketProductId === data.basketProductId);
173
171
 
174
172
  const basket = JSON.parse(localStorage.getItem("basket"));
175
173
  const basketId = !rootState.orderiomApiPackage.auth.privateToken
@@ -187,7 +185,7 @@ const actions = {
187
185
  $http
188
186
  .post("api/basket/add", {
189
187
  ...basketId,
190
- productId: basketProduct.RestaurantProductId,
188
+ productId: data.productId,
191
189
  quantity: !data.quantity || data.quantity < 1 ? 1 : data.quantity,
192
190
  attributeItems: data.attributeItems.length
193
191
  ? data.attributeItems
@@ -372,10 +370,9 @@ const actions = {
372
370
  });
373
371
  },
374
372
  addProductPackageItem({ dispatch, rootState }, data) {
375
- const basketProduct =
376
- rootState.orderiomApiPackage.product.ShoppingCart.find(
377
- (f) => f.basketProductId === Number(data.productId)
378
- );
373
+ const basketProduct = !data.basketProductId
374
+ ? null
375
+ : rootState.orderiomApiPackage.product.ShoppingCart.find(f => f.basketProductId === Number(data.basketProductId));
379
376
 
380
377
  const basket = JSON.parse(localStorage.getItem("basket"));
381
378
  const basketId = !rootState.orderiomApiPackage.auth.privateToken
@@ -393,7 +390,6 @@ const actions = {
393
390
  .post("api/basket/add-product-package-items", {
394
391
  ...basketId,
395
392
  ...data,
396
- productId: basketProduct.RestaurantProductId,
397
393
  quantity: !data.quantity || data.quantity < 1 ? 1 : data.quantity,
398
394
  })
399
395
  .then(async () => {