orderiom-api-package 0.4.80 → 0.4.82
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/modules/product.js +19 -9
package/package.json
CHANGED
package/src/modules/product.js
CHANGED
|
@@ -356,6 +356,8 @@ const actions = {
|
|
|
356
356
|
}
|
|
357
357
|
}).then(res => {
|
|
358
358
|
res.data.data.forEach(productInCategory => {
|
|
359
|
+
productInCategory.happyHours = [];
|
|
360
|
+
|
|
359
361
|
let quantity = 0;
|
|
360
362
|
state.ShoppingCart
|
|
361
363
|
.filter(itemInCart => Number(itemInCart.RestaurantProductId) === Number(productInCategory.id))
|
|
@@ -396,6 +398,8 @@ const actions = {
|
|
|
396
398
|
}
|
|
397
399
|
if (res.data.data.length) {
|
|
398
400
|
res.data.data.forEach(productInCategory => {
|
|
401
|
+
productInCategory.happyHours = [];
|
|
402
|
+
|
|
399
403
|
let quantity = 0;
|
|
400
404
|
state.ShoppingCart
|
|
401
405
|
.filter(itemInCart => Number(itemInCart.RestaurantProductId) === Number(productInCategory.id))
|
|
@@ -448,18 +452,24 @@ const actions = {
|
|
|
448
452
|
const data = res.data.data || [];
|
|
449
453
|
if(!Array.isArray(data)) return {...res, data: []};
|
|
450
454
|
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
455
|
+
const productList = state.showPinnedProducts ? state.pinnedProducts : state.products;
|
|
456
|
+
if(!productList || !productList.length){
|
|
457
|
+
console.error(`getProductsHappyHourTime: product list is empty`);
|
|
458
|
+
return;
|
|
459
|
+
}
|
|
460
|
+
|
|
461
|
+
data.forEach(({happyHour: happyHours, id: productId}) => {
|
|
462
|
+
if(!happyHours || !happyHours.length) return;
|
|
463
|
+
const product = productList.find(product => product.id === productId);
|
|
454
464
|
if(!product) {
|
|
455
|
-
console.
|
|
465
|
+
console.error(`getProductsHappyHourTime: Could not assign happyHours to product:${productId}`);
|
|
456
466
|
return;
|
|
457
467
|
}
|
|
458
|
-
product.
|
|
459
|
-
weekday_id:
|
|
460
|
-
start_date:
|
|
461
|
-
end_date:
|
|
462
|
-
}
|
|
468
|
+
product.happyHours = happyHours.map(happyHourItem => ({
|
|
469
|
+
weekday_id: happyHourItem.weekday_id,
|
|
470
|
+
start_date: happyHourItem.start_date,
|
|
471
|
+
end_date: happyHourItem.end_date,
|
|
472
|
+
}))
|
|
463
473
|
})
|
|
464
474
|
|
|
465
475
|
return {...res, data};
|