orderiom-api-package 0.3.14 → 0.3.16

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.14",
3
+ "version": "0.3.16",
4
4
  "description": "This package will install all necessary API calls for every orderiom restaurant",
5
5
  "main": "index.js",
6
6
  "scripts": {
package/src/common.js CHANGED
@@ -48,6 +48,7 @@ export function updateBasket({commit, basketId, res, restaurantId}){
48
48
 
49
49
  commit(`product/SetShoppingCart`, basketInfo.products, { root: true });
50
50
  commit(`product/setDeliveryTime`, basketInfo.deliveryTime, { root: true });
51
+ commit(`product/setServiceDuration`, basketInfo.duration, { root: true });
51
52
  commit(`product/setVoucherCode`, basketInfo.voucher_code, { root: true });
52
53
  commit(`product/setVoucherValue`, basketInfo.voucherValue, { root: true });
53
54
  commit(`product/setTotalWithDiscount`, basketInfo.totalWithDiscount, { root: true });
@@ -581,20 +581,23 @@ const actions = {
581
581
  },
582
582
  addDeliveryTimeToBasket({ dispatch, rootState }, data) {
583
583
  const basket = JSON.parse(localStorage.getItem("basket"));
584
+ const restaurantId = parseInt(data.restaurantId ? data.restaurantId : restaurantIdEnv)
584
585
  const basketId = !rootState.orderiomApiPackage.auth.privateToken ? {
585
- basketId: basket.find((basket) => basket.restaurantId == data.restaurantId).basketId
586
+ basketId: basket.find(basket =>
587
+ parseInt(basket.restaurantId) === parseInt(restaurantId)
588
+ ).basketId
586
589
  } : {}
587
590
  return axios
588
591
  .post("api/basket/add-delivery-time", {
589
592
  ...basketId,
590
593
  delivery_time: data.date && data.time ? data.date + " " + data.time : null,
591
- restaurantId: data.restaurantId,
592
- deliveryType: data.deliveryType
593
-
594
+ deliveryType: data.deliveryType,
595
+ duration: data.duration || undefined,
596
+ restaurantId
594
597
  })
595
598
  .then((res) => {
596
599
  // console.log(res);
597
- dispatch('product/getBasket', data.restaurantId, { root: true })
600
+ dispatch('product/getBasket', restaurantId, { root: true })
598
601
  return {
599
602
  type: 'success',
600
603
  msg: 'ok'
@@ -13,6 +13,7 @@ const state = () => ({
13
13
  SubtotalPrice: null,
14
14
  TotalPrice: null,
15
15
  deliveryTime: null,
16
+ serviceDuration: null,
16
17
  attributes: null,
17
18
  attributeItems: null,
18
19
  voucherCode: null,
@@ -67,6 +68,9 @@ const mutations = {
67
68
  setDeliveryTime(state, time) {
68
69
  state.deliveryTime = time;
69
70
  },
71
+ setServiceDuration(state, duration){
72
+ state.serviceDuration = duration;
73
+ },
70
74
  setAttributes(state, attributes) {
71
75
  state.attributes = attributes
72
76
  },