Socket
Socket
Sign inDemoInstall

orderiom-api-package

Package Overview
Dependencies
2
Maintainers
1
Versions
171
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.1.9 to 0.2.0

2

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

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

@@ -212,4 +212,4 @@ import axios from "axios";

},
logout({ commit, state }, data) {
const restaurantId = data ? { restaurantId: data } : {}
logout({ commit, state }, restaurantId) {
const restaurantId = restaurantId ? { restaurantId: restaurantId } : {}

@@ -227,4 +227,5 @@ if (!state.privateToken) {

commit("clearAuthData");
commit("product/SetShoppingCart", [], { root: true });
commit("product/SetSubtotalPrice", null, { root: true });
dispatch('unassignBasket', restaurantId)
// commit("product/SetShoppingCart", [], { root: true });
// commit("product/SetSubtotalPrice", null, { root: true });
return true

@@ -317,2 +318,68 @@ })

},
unassignBasket({ }, restaurantId) {
if (restaurantId) {
const basket = JSON.parse(localStorage.getItem("basket"));
const basketId = basket.length ?
basket.find((basket) => basket.restaurantId == restaurantId).basketId
: ''
if (basketId)
axios
.post(`api/basket/unassigned-basket`, null, { params: { basketId: basketId } })
.then(() => {
return {
type: 'success',
msg: 'ok'
};
})
.catch((error) => {
if (error.response) {
if (error.response.status == 422) {
return {
type: 'error',
msg: Object.values(error.response.data.error.validation).map(m => { return m[0] }).toString()
}
}
if (error.response.status == 401 || error.response.status == 403 || error.response.status == 404 || error.response.status == 400) {
return {
type: 'error',
msg: error.response.data.message.body
}
}
}
});
}
else {
let basket = JSON.parse(localStorage.getItem("basket"));
if (!basket.length) return
let baskets = basket.map(m => m.basketId)
for (let i = 0; i < baskets.length; i++) {
axios
.post(`api/basket/unassigned-basket`, null, { params: { basketId: baskets[i] } })
.then(() => {
return {
type: 'success',
msg: 'ok'
};
})
.catch((error) => {
if (error.response) {
if (error.response.status == 422) {
return {
type: 'error',
msg: Object.values(error.response.data.error.validation).map(m => { return m[0] }).toString()
}
}
if (error.response.status == 401 || error.response.status == 403 || error.response.status == 404 || error.response.status == 400) {
return {
type: 'error',
msg: error.response.data.message.body
}
}
}
});
}
}
},
restaurantInfo({ commit }, restaurantId) {

@@ -319,0 +386,0 @@ return axios

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc