orderiom-api-package 0.2.52 → 0.2.54

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.2.52",
3
+ "version": "0.2.54",
4
4
  "description": "This package will install all necessary API calls for every orderiom restaurant",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -61,7 +61,7 @@ const actions = {
61
61
  if(!getBasketSuccess || getProductsResult.type !== 'success'){
62
62
  return {
63
63
  type: 'error',
64
- msg: 'There was an error in fetching basket and products'
64
+ msg: 'There was an error in fetching the basket and products'
65
65
  }
66
66
  }
67
67
  return {
@@ -159,15 +159,15 @@ const actions = {
159
159
  const basketId = !rootState.orderiomApiPackage.auth.privateToken ? {
160
160
  basketId: basket.find((basket) => basket.restaurantId == data.restaurantId).basketId
161
161
  } : {}
162
- const attributeItems = data.attributeItems.length ? { attributeItems: data.attributeItems } : {}
163
162
 
164
163
  if(basketProduct) basketProduct.changingQuantity = true;
165
164
  axios.post("api/basket/add", {
166
165
  ...basketId,
167
166
  productId: data.productId,
168
167
  quantity: 1,
169
- ...attributeItems,
168
+ attributeItems: data.attributeItems.length ? data.attributeItems : undefined,
170
169
  restaurantId: data.restaurantId,
170
+ extraInfo: data.extraInfo
171
171
  }).then(async () => {
172
172
  return await dispatch('shoppingCartUpdateCallback', { restaurantId: data.restaurantId });
173
173
  }).catch(
@@ -311,19 +311,12 @@ const actions = {
311
311
  f.RestaurantProductId === Number(data.productId)
312
312
  );
313
313
 
314
- if(!basketProduct){
315
- return {
316
- type: 'error',
317
- msg: 'Product not found'
318
- }
319
- }
320
-
321
314
  const basket = JSON.parse(localStorage.getItem("basket"));
322
315
  const basketId = !rootState.orderiomApiPackage.auth.privateToken ? {
323
316
  basketId: basket.find((basket) => basket.restaurantId == data.restaurantId).basketId
324
317
  } : {}
325
318
 
326
- basketProduct.changingQuantity = true;
319
+ if(basketProduct) basketProduct.changingQuantity = true;
327
320
  return axios.post('api/basket/add-product-package-items', {
328
321
  ...basketId,
329
322
  ...data
@@ -332,7 +325,7 @@ const actions = {
332
325
  }).catch(
333
326
  commonErrorCallback()
334
327
  ).finally(() => {
335
- basketProduct.changingQuantity = false;
328
+ if(basketProduct) basketProduct.changingQuantity = false;
336
329
  });
337
330
  },
338
331
  addAddress({ rootState }, data) {