orderiom-api-package 0.3.19 → 0.3.21

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "orderiom-api-package",
3
- "version": "0.3.19",
3
+ "version": "0.3.21",
4
4
  "description": "This package will install all necessary API calls for every orderiom restaurant",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -395,7 +395,24 @@ const actions = {
395
395
  // commit('setorder', res.data.data.order)
396
396
  // commit('setuserOrder', JSON.parse(res.data.data.order.user_details));
397
397
  // commit('setshippigPriceOrder', res.data.data.order.shipping_price);
398
- window.location = res.data.data.paymentLink;
398
+
399
+ if(!data.$router || !data.routeName){
400
+ window.location = res.data.data.paymentLink;
401
+ }else{
402
+ data.$router.push({
403
+ name: data.routeName,
404
+ query: res.data.data.paymentLink
405
+ .split('?')[1]
406
+ .split('&')
407
+ .map(query => query.split('='))
408
+ .reduce((result, element) => {
409
+ if(!element) return result;
410
+ result[element[0]] = element[1];
411
+ return result;
412
+ }, {})
413
+ });
414
+ }
415
+
399
416
  var index = data.basket ? basketData.indexOf(basketData.find((item) => item.basketId == data.basket)) :
400
417
  basketData.indexOf(basketData.find((item) => item.restaurantId == data.restaurantId));
401
418
  if (index > -1) {
@@ -6,7 +6,7 @@ const state = () => ({
6
6
  selectedTime: null,
7
7
  selectedDate: null,
8
8
  categories: [],
9
- subCategoris: [],
9
+ subCategories: [],
10
10
  selectedCategory: null,
11
11
  products: null,
12
12
  selectedProduct: null,
@@ -120,8 +120,8 @@ const mutations = {
120
120
  basketLoadedOnce(state){
121
121
  state.basketLoadedOnce = true;
122
122
  },
123
- setSubCategories(state , subCategoris){
124
- state.subCategoris = subCategoris;
123
+ setSubCategories(state , subCategories){
124
+ state.subCategories = subCategories;
125
125
  }
126
126
  };
127
127
  const actions = {
@@ -219,7 +219,7 @@ const actions = {
219
219
  commit("setSelectedCategory", data.category);
220
220
 
221
221
  let basketId = undefined;
222
- const subCategoris =[];
222
+ const subCategories =[];
223
223
  try{
224
224
  basketId = calculateBasketIdParameter(!!rootState.orderiomApiPackage.auth.privateToken, data.restaurantId);
225
225
  } catch(e) {
@@ -233,15 +233,16 @@ const actions = {
233
233
  basketId
234
234
  }}).then(res => {
235
235
  res.data.data.forEach(productInCategory => {
236
- if(productInCategory.subcategory_name && !state.subCategoris.includes(productInCategory.subcategory_name)){
237
- subCategoris.push(productInCategory.subcategory_name)
236
+ console.log(state.subCategories.includes(productInCategory.subcategory_name));
237
+ if(productInCategory.subcategory_name && !subCategories.includes(productInCategory.subcategory_name) ){
238
+ subCategories.push(productInCategory.subcategory_name)
238
239
  }
239
240
  productInCategory.quantity = state.ShoppingCart
240
241
  .filter(itemInCart => Number(itemInCart.RestaurantProductId) === Number(productInCategory.id))
241
242
  .reduce((a, b) => a.quantity + b.quantity, 0)
242
243
  });
243
244
 
244
- commit('setSubCategories' , subCategoris)
245
+ commit('setSubCategories' , subCategories)
245
246
  commit("setProduct", res.data.data);
246
247
  return { type: 'success', data: res.data.data }
247
248
  }).catch(