orderiom-api-package 0.4.53 → 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 +12 -2
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) {
|
|
@@ -154,6 +158,9 @@ const getters = {
|
|
|
154
158
|
}
|
|
155
159
|
}
|
|
156
160
|
const mutations = {
|
|
161
|
+
setFetchingProducts(state, isFetching){
|
|
162
|
+
state.fetchingProducts = isFetching;
|
|
163
|
+
},
|
|
157
164
|
setSelectedDate(state, date) {
|
|
158
165
|
state.selectedDate = date
|
|
159
166
|
},
|
|
@@ -344,6 +351,7 @@ const actions = {
|
|
|
344
351
|
].join(' ')
|
|
345
352
|
}
|
|
346
353
|
|
|
354
|
+
commit('setFetchingProducts', true);
|
|
347
355
|
return $http.get("api/restaurant/products", {
|
|
348
356
|
params: {
|
|
349
357
|
categoryId: data.category.id,
|
|
@@ -363,7 +371,9 @@ const actions = {
|
|
|
363
371
|
return { ...res, data: res.data.data }
|
|
364
372
|
}).catch(
|
|
365
373
|
commonErrorCallback()
|
|
366
|
-
)
|
|
374
|
+
).finish(() => {
|
|
375
|
+
commit('setFetchingProducts', false);
|
|
376
|
+
});
|
|
367
377
|
},
|
|
368
378
|
getPinnedProducts({ commit, state, rootState }, data) {
|
|
369
379
|
let basketId = undefined;
|