orderiom-api-package 0.4.67 → 0.4.69
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 +11 -16
package/package.json
CHANGED
package/src/modules/product.js
CHANGED
|
@@ -31,6 +31,7 @@ const state = () => ({
|
|
|
31
31
|
showPinnedProducts: false,
|
|
32
32
|
fetchingProducts: false,
|
|
33
33
|
categoriesFetchedOnce: false,
|
|
34
|
+
pinnedProductsFetchedOnce: false
|
|
34
35
|
});
|
|
35
36
|
const getters = {
|
|
36
37
|
fetchingProducts(state){
|
|
@@ -166,6 +167,9 @@ const mutations = {
|
|
|
166
167
|
setCategoriesFetchedOnce(state){
|
|
167
168
|
state.categoriesFetchedOnce = true;
|
|
168
169
|
},
|
|
170
|
+
setPinnedProductsFetchedOnce(state){
|
|
171
|
+
state.pinnedProductsFetchedOnce = true;
|
|
172
|
+
},
|
|
169
173
|
setFetchingProducts(state, isFetching){
|
|
170
174
|
state.fetchingProducts = isFetching;
|
|
171
175
|
},
|
|
@@ -301,21 +305,10 @@ const actions = {
|
|
|
301
305
|
else commit('setCategories', categories);
|
|
302
306
|
|
|
303
307
|
if(state.categories.length){
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
})
|
|
309
|
-
}else{
|
|
310
|
-
// if selected category is set then check if it is the same category. If it is the same then there is no need to do anything.
|
|
311
|
-
const catInList = categories.find(cat => cat.id === state.selectedCategory.id);
|
|
312
|
-
if(!catInList || JSON.stringify(state.selectedCategory) !== JSON.stringify(catInList)){
|
|
313
|
-
dispatch('chooseCategory', {
|
|
314
|
-
category: state.categories[0],
|
|
315
|
-
restaurantId
|
|
316
|
-
})
|
|
317
|
-
}
|
|
318
|
-
}
|
|
308
|
+
dispatch('chooseCategory', {
|
|
309
|
+
category: state.categories[0],
|
|
310
|
+
restaurantId
|
|
311
|
+
})
|
|
319
312
|
}
|
|
320
313
|
}).catch(
|
|
321
314
|
commonErrorCallback()
|
|
@@ -411,7 +404,9 @@ const actions = {
|
|
|
411
404
|
return { ...res, data: res.data.data }
|
|
412
405
|
}).catch(
|
|
413
406
|
commonErrorCallback()
|
|
414
|
-
)
|
|
407
|
+
).finally(() => {
|
|
408
|
+
commit('setPinnedProductsFetchedOnce');
|
|
409
|
+
});
|
|
415
410
|
},
|
|
416
411
|
getBasket({ commit, rootState }, data) {
|
|
417
412
|
if(['string', 'number', 'undefined'].includes(typeof data)) data = {restaurantId: data};
|