orderiom-api-package 0.4.47 → 0.4.49

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.4.47",
3
+ "version": "0.4.49",
4
4
  "description": "This package will install all necessary API calls for every orderiom restaurant",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",
@@ -632,8 +632,8 @@ const actions = {
632
632
  if (status === 422) {
633
633
  const validation = error.response.data.error.validation;
634
634
 
635
- const name = validation.name?.length ? validation.name[0] : 'N/A';
636
- const validTime = validation.validTime?.length ? validation.validTime[0] : 'N/A';
635
+ const name = validation.name && validation.name.length ? validation.name[0] : 'N/A';
636
+ const validTime = validation.validTime && validation.validTime.length ? validation.validTime[0] : 'N/A';
637
637
  delete validation.name;
638
638
  delete validation.validTime;
639
639
 
@@ -852,8 +852,8 @@ const actions = {
852
852
  if (status === 422) {
853
853
  const validation = error.response.data.error.validation;
854
854
 
855
- const name = validation.name?.length ? validation.name[0] : 'N/A';
856
- const validTime = validation.validTime?.length ? validation.validTime[0] : 'N/A';
855
+ const name = validation.name && validation.name.length ? validation.name[0] : 'N/A';
856
+ const validTime = validation.validTime && validation.validTime.length ? validation.validTime[0] : 'N/A';
857
857
  delete validation.name;
858
858
  delete validation.validTime;
859
859
 
@@ -1,4 +1,4 @@
1
- import {commonErrorCallback, calculateBasketIdParameter, updateBasket, deliveryCodeToName, weekdays, $http} from '../common';
1
+ import {commonErrorCallback, calculateBasketIdParameter, updateBasket, formatDate, formatTime, deliveryCodeToName, weekdays, $http} from '../common';
2
2
 
3
3
  const state = () => ({
4
4
  selectedTime: null,
@@ -323,11 +323,21 @@ const actions = {
323
323
  } catch(e) {
324
324
  console.error("getProducts: " + e);
325
325
  }
326
+
327
+ let delivery_time = undefined;
328
+ if(state.deliveryTime){
329
+ delivery_time = new Date(state.deliveryTime);
330
+ delivery_time = [
331
+ formatDate(delivery_time),
332
+ formatTime(delivery_time)
333
+ ].join(' ')
334
+ }
335
+
326
336
  return $http.get("api/restaurant/products", {
327
337
  params: {
328
338
  categoryId: data.category.id,
329
339
  restaurantId: data.restaurantId,
330
- delivery_time: state.deliveryTime || undefined,
340
+ delivery_time,
331
341
  basketId: basketId
332
342
  }
333
343
  }).then(res => {