orderiom-api-package 0.4.66 → 0.4.68

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.66",
3
+ "version": "0.4.68",
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",
@@ -31,21 +31,26 @@ 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){
37
38
  return !!state.fetchingProducts;
38
39
  },
39
40
  subCategories(state){
40
- if(!state.products) return []
41
41
  if(state.showPinnedProducts) {
42
- return [{
43
- id: null,
44
- imagePath:null,
45
- name:null,
46
- priority:null
47
- }]
42
+ if(state.pinnedProducts?.length){
43
+ return [{
44
+ id: null,
45
+ imagePath:null,
46
+ name:null,
47
+ priority:null
48
+ }]
49
+ }else{
50
+ return []
51
+ }
48
52
  }
53
+ if(!state.products?.length) return []
49
54
  const subCategories = [];
50
55
  const ids = Array.from(new Set(state.products.map(productInCategory=>
51
56
  productInCategory.subcategory_id
@@ -162,6 +167,9 @@ const mutations = {
162
167
  setCategoriesFetchedOnce(state){
163
168
  state.categoriesFetchedOnce = true;
164
169
  },
170
+ setPinnedProductsFetchedOnce(state){
171
+ state.pinnedProductsFetchedOnce = true;
172
+ },
165
173
  setFetchingProducts(state, isFetching){
166
174
  state.fetchingProducts = isFetching;
167
175
  },
@@ -407,7 +415,9 @@ const actions = {
407
415
  return { ...res, data: res.data.data }
408
416
  }).catch(
409
417
  commonErrorCallback()
410
- );
418
+ ).finally(() => {
419
+ commit('setPinnedProductsFetchedOnce');
420
+ });
411
421
  },
412
422
  getBasket({ commit, rootState }, data) {
413
423
  if(['string', 'number', 'undefined'].includes(typeof data)) data = {restaurantId: data};