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.41 to 0.2.42

2

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

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

@@ -6,2 +6,19 @@ import axios from "axios";

function calculateBasketIdParameter(isLogin) {
if(isLogin) 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;
}
const state = () => ({

@@ -117,18 +134,2 @@ selectedTime: null,

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;
},
// TODO: note the axios in loop

@@ -256,3 +257,3 @@ // Orderiom api doesn't use this function

},
getProducts({ commit, state, dispatch }, data) {
getProducts({ commit, state, rootState }, data) {
commit("setSelectedCategory", data.category);

@@ -262,4 +263,5 @@

try{
basketId = dispatch('calculateBasketIdParameter');
} catch {
basketId = calculateBasketIdParameter(!!rootState.orderiomApiPackage.auth.privateToken);
} catch(e) {
console.error(e);
return { type: 'error', msg: 'Basket not found' }

@@ -462,7 +464,8 @@ }

},
changeDeliveryMethod({ commit, dispatch, rootState }, deliveryType){
changeDeliveryMethod({ commit, dispatch, rootState, state }, deliveryType){
let basketId = undefined;
try{
basketId = dispatch('calculateBasketIdParameter');
} catch {
basketId = calculateBasketIdParameter(!!rootState.orderiomApiPackage.auth.privateToken);
} catch(e) {
console.error(e);
return { type: 'error', msg: 'Basket not found' }

@@ -469,0 +472,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