orderiom-api-package
Advanced tools
Comparing version 0.4.24 to 0.4.25
{ | ||
"name": "orderiom-api-package", | ||
"version": "0.4.24", | ||
"version": "0.4.25", | ||
"description": "This package will install all necessary API calls for every orderiom restaurant", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -246,3 +246,3 @@ import {commonErrorCallback, calculateBasketIdParameter, updateBasket, deliveryCodeToName, weekdays, restaurantIdEnv, $http} from '../common'; | ||
const actions = { | ||
getCategories({ commit, dispatch, rootState }, restaurantId) { | ||
getCategories({ commit, dispatch, rootState, state }, restaurantId) { | ||
let basketId = undefined; | ||
@@ -268,3 +268,13 @@ try { | ||
commit('setCategories', categories); | ||
commit("setSelectedCategory", categories[0]); | ||
if(categories.length){ | ||
if(!state.selectedCategory) { | ||
commit("setSelectedCategory", categories[0]); | ||
}else{ | ||
const catInList = categories.find(cat => cat.id === state.selectedCategory.id); | ||
if(!catInList || JSON.stringify(state.selectedCategory) !== JSON.stringify(catInList)){ | ||
commit("setSelectedCategory", categories[0]); | ||
} | ||
} | ||
} | ||
dispatch("getProducts", { | ||
@@ -280,3 +290,13 @@ category: categories[0], | ||
commit('setCategories', categories); | ||
commit("setSelectedCategory", categories[0]); | ||
if(categories.length){ | ||
if(!state.selectedCategory) { | ||
commit("setSelectedCategory", categories[0]); | ||
}else{ | ||
const catInList = categories.find(cat => cat.id === state.selectedCategory.id); | ||
if(!catInList || JSON.stringify(state.selectedCategory) !== JSON.stringify(catInList)){ | ||
commit("setSelectedCategory", categories[0]); | ||
} | ||
} | ||
} | ||
dispatch("getProducts", { | ||
@@ -283,0 +303,0 @@ category: categories[0], |
112895
2955