orderiom-api-package 0.4.52 → 0.4.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 +1 -1
- package/src/modules/product.js +24 -13
package/package.json
CHANGED
package/src/modules/product.js
CHANGED
|
@@ -28,9 +28,13 @@ const state = () => ({
|
|
|
28
28
|
changingDeliveryType: false,
|
|
29
29
|
basketLoadedOnce: false,
|
|
30
30
|
pinnedProducts: null,
|
|
31
|
-
showPinnedProducts: false
|
|
31
|
+
showPinnedProducts: false,
|
|
32
|
+
fetchingProducts: false,
|
|
32
33
|
});
|
|
33
34
|
const getters = {
|
|
35
|
+
fetchingProducts(state){
|
|
36
|
+
return !!state.orderiomApiPackage.product.fetchingProducts;
|
|
37
|
+
},
|
|
34
38
|
subCategories(state){
|
|
35
39
|
if(!state.products) return []
|
|
36
40
|
if(state.showPinnedProducts) {
|
|
@@ -74,17 +78,18 @@ const getters = {
|
|
|
74
78
|
getters.deliveryTimes.map(item => item.weekday)
|
|
75
79
|
)).map(item => weekdays.indexOf(item) + 1)
|
|
76
80
|
|
|
77
|
-
const
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
}
|
|
87
|
-
|
|
81
|
+
const result = [{
|
|
82
|
+
weekdays: [1, 2, 3, 4, 5, 6, 7].filter(item => !allowedWeekDays.includes(item)),
|
|
83
|
+
}];
|
|
84
|
+
|
|
85
|
+
let start = rootState.orderiomApiPackage.restaurant.restaurantInfo.restaurant_close_times;
|
|
86
|
+
let end = rootState.orderiomApiPackage.restaurant.restaurantInfo.restaurant_end_close_times;
|
|
87
|
+
start = start && start.length ? start[0] : null;
|
|
88
|
+
end = end && end.length ? end[0] : null;
|
|
89
|
+
if(start && end){
|
|
90
|
+
result.push({start, end})
|
|
91
|
+
}
|
|
92
|
+
return result;
|
|
88
93
|
},
|
|
89
94
|
availableTimes(state, getters){
|
|
90
95
|
const result = {};
|
|
@@ -153,6 +158,9 @@ const getters = {
|
|
|
153
158
|
}
|
|
154
159
|
}
|
|
155
160
|
const mutations = {
|
|
161
|
+
setFetchingProducts(state, isFetching){
|
|
162
|
+
state.fetchingProducts = isFetching;
|
|
163
|
+
},
|
|
156
164
|
setSelectedDate(state, date) {
|
|
157
165
|
state.selectedDate = date
|
|
158
166
|
},
|
|
@@ -343,6 +351,7 @@ const actions = {
|
|
|
343
351
|
].join(' ')
|
|
344
352
|
}
|
|
345
353
|
|
|
354
|
+
commit('setFetchingProducts', true);
|
|
346
355
|
return $http.get("api/restaurant/products", {
|
|
347
356
|
params: {
|
|
348
357
|
categoryId: data.category.id,
|
|
@@ -362,7 +371,9 @@ const actions = {
|
|
|
362
371
|
return { ...res, data: res.data.data }
|
|
363
372
|
}).catch(
|
|
364
373
|
commonErrorCallback()
|
|
365
|
-
)
|
|
374
|
+
).finish(() => {
|
|
375
|
+
commit('setFetchingProducts', false);
|
|
376
|
+
});
|
|
366
377
|
},
|
|
367
378
|
getPinnedProducts({ commit, state, rootState }, data) {
|
|
368
379
|
let basketId = undefined;
|