orderiom-api-package 0.3.23 → 0.3.25

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.3.23",
3
+ "version": "0.3.25",
4
4
  "description": "This package will install all necessary API calls for every orderiom restaurant",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -33,9 +33,18 @@ const state = () => ({
33
33
  const getters = {
34
34
  subCategories(state){
35
35
  if(!state.products) return []
36
- return Array.from(new Set(state.products.map(productInCategory =>
37
- productInCategory.subcategory_name || 'uncategorised'
38
- )))
36
+ const subCategories = [];
37
+ const ids = Array.from(new Set(state.products.map(productInCategory=>
38
+ productInCategory.subcategory_id
39
+ )))
40
+
41
+ ids.forEach(id=>{
42
+ let filter = state.products.find(i=> i.subcategory_id === id)
43
+ subCategories.push({name: filter.subcategory_name, id: filter.subcategory_id, imagePath: filter.subcategory_image})
44
+ })
45
+
46
+ return subCategories
47
+
39
48
  }
40
49
  }
41
50
  const mutations = {
@@ -311,7 +320,7 @@ const actions = {
311
320
  commonErrorCallback()
312
321
  );
313
322
  },
314
- changeDeliveryMethod({ commit, dispatch, rootState, state }, deliveryType, restaurantId = null){
323
+ changeDeliveryMethod({ commit, dispatch, rootState, state }, {deliveryType, restaurantId = null}){
315
324
  let basketId = undefined;
316
325
  try{
317
326
  basketId = calculateBasketIdParameter(!!rootState.orderiomApiPackage.auth.privateToken, restaurantId);
@@ -353,7 +362,7 @@ const actions = {
353
362
  commit('finishChangingDeliveryType');
354
363
  });
355
364
  },
356
- getProductsFromAllCategories({ commit, state, rootState }, categories = null, restaurantId = null) {
365
+ getProductsFromAllCategories({ commit, state, rootState }, {categories = null, restaurantId = null}) {
357
366
  let basketId = undefined;
358
367
  try{
359
368
  basketId = calculateBasketIdParameter(!!rootState.orderiomApiPackage.auth.privateToken, restaurantId);
@@ -176,7 +176,7 @@ const actions = {
176
176
  return commonErrorCallback()(error);
177
177
  })
178
178
  },
179
- getBlogsByTag({ commit }, tagId, restaurantId = null) {
179
+ getBlogsByTag({ commit },{tagId, restaurantId = null}) {
180
180
  commit('startFetchingBlogs');
181
181
  return axios.get('/api/blogs/by-tag', {
182
182
  params: {
@@ -211,7 +211,7 @@ const actions = {
211
211
  return commonErrorCallback()(error);
212
212
  })
213
213
  },
214
- getBlogBySlug({ commit }, blogSlug, restaurantId = null) {
214
+ getBlogBySlug({ commit },{blogSlug, restaurantId = null}) {
215
215
  return axios.get('api/blogs/show/slug', { params: {blogSlug, restaurantId: restaurantId || restaurantIdEnv}}).then(res => {
216
216
  commit('setBlog', res.data.data);
217
217
  return { type: 'success', msg: 'ok' }