New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

orderiom-api-package

Package Overview
Dependencies
Maintainers
0
Versions
224
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

orderiom-api-package - npm Package Compare versions

Comparing version 0.4.61 to 0.4.62

2

package.json
{
"name": "orderiom-api-package",
"version": "0.4.61",
"version": "0.4.62",
"description": "This package will install all necessary API calls for every orderiom restaurant",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -264,2 +264,7 @@ import {commonErrorCallback, calculateBasketIdParameter, updateBasket, formatDate, formatTime, deliveryCodeToName, weekdays, $http} from '../common';

const actions = {
chooseCategory({commit, dispatch, state}, {category, restaurantId}){
commit("setSelectedCategory", category);
dispatch("getProducts", {category, restaurantId,});
dispatch("getAttributeItems", {category, restaurantId});
},
getCategories({ commit, dispatch, rootState, state }, restaurantId) {

@@ -274,61 +279,44 @@ let basketId = undefined;

}
return $http
.get("api/restaurant/category", { params: { restaurantId: restaurantId, basketId: basketId } })
.then((res) => {
let categories = res.data.data;
//TODO: why calling an api write after another while we can do it together?
//TODO: this api call returns empty on restaurant refresh
$http
.get("api/restaurant/category", { params: { restaurantId: restaurantId, extra: 1, basketId: basketId } })
.then((res) => {
if (res.data.data.length) {
categories = [...categories, ...res.data.data];
commit('setCategories', categories);
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", {
category: state.selectedCategory,
restaurantId,
});
dispatch("getAttributeItems", {
category: state.selectedCategory,
restaurantId
});
} else {
commit('setCategories', categories);
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]);
}
}
}
return $http.get("api/restaurant/category", { params: {
restaurantId,
basketId
}}).then(res => {
let categories = res.data.data;
dispatch("getProducts", {
category: state.selectedCategory,
restaurantId,
});
dispatch("getAttributeItems", {
category: state.selectedCategory,
restaurantId
});
}
});
return res
})
.catch(
commonErrorCallback()
);
$http.get("api/restaurant/category", { params: {
restaurantId,
basketId,
extra: 1,
}}).then(res => {
const extraCategories = res.data.data;
if (extraCategories.length) commit('setCategories', [...categories, ...extraCategories]);
else commit('setCategories', categories);
if(state.categories.length){
if(!state.selectedCategory) {
dispatch('chooseCategory', {
category: state.categories[0],
restaurantId
})
}else{
// 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.
const catInList = categories.find(cat => cat.id === state.selectedCategory.id);
if(!catInList || JSON.stringify(state.selectedCategory) !== JSON.stringify(catInList)){
dispatch('chooseCategory', {
category: state.categories[0],
restaurantId
})
}
}
}
}).catch(
commonErrorCallback()
);
return res
}).catch(
commonErrorCallback()
);
},

@@ -335,0 +323,0 @@ getProducts({ commit, state, rootState }, data) {

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc