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
1
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.2.39 to 0.2.40

2

package.json
{
"name": "orderiom-api-package",
"version": "0.2.39",
"version": "0.2.40",
"description": "this package will install all neccessary api calls for every orderiom restaurant",

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

@@ -116,2 +116,18 @@ import axios from "axios";

const actions = {
calculateBasketIdParameter({ rootState }){
if(rootState.orderiomApiPackage.auth.privateToken) return undefined;
// localStorage might fail
let baskets = [];
try{
baskets = JSON.parse(localStorage.getItem("basket")) || [];
}catch(e){
console.error(e);
throw new Error('Basket not found');
}
const foundBasket = baskets.find(basket => basket.restaurantId === restaurantId);
if(!foundBasket){
throw new Error('Basket not found');
}
return foundBasket.basketId;
},
getCategoriesWithProducts({ commit, dispatch }, restaurantId) {

@@ -234,12 +250,17 @@ return axios

},
getProducts({ commit, state }, data) {
getProducts({ commit, state, dispatch }, data) {
commit("setSelectedCategory", data.category);
const params = {
let basketId = undefined;
try{
basketId = dispatch('calculateBasketIdParameter');
} catch {
return { type: 'error', msg: 'Basket not found' }
}
return axios.get("api/restaurant/products", {params: {
categoryId: data.category.id,
restaurantId: data.restaurantId,
};
if(data.deliveryType) params.deliveryType = data.deliveryType;
return axios.get("api/restaurant/products", { params }).then(res => {
basketId
}}).then(res => {
let products = res.data.data;

@@ -436,16 +457,6 @@ products.map(m => {

let basketId = undefined;
if(!rootState.orderiomApiPackage.auth.privateToken){
// localStorage might fail
let baskets = [];
try{
baskets = JSON.parse(localStorage.getItem("basket")) || [];
}catch(e){
console.error(e);
}
const foundBasket = baskets.find(basket => basket.restaurantId === restaurantId);
basketId = foundBasket ? foundBasket.basketId : null;
if(!basketId){
return { type: 'error', msg: 'Basket not found' }
}
try{
basketId = dispatch('calculateBasketIdParameter');
} catch {
return { type: 'error', msg: 'Basket not found' }
}

@@ -452,0 +463,0 @@

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