orderiom-api-package 0.4.45 → 0.4.46

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.4.45",
3
+ "version": "0.4.46",
4
4
  "description": "This package will install all necessary API calls for every orderiom restaurant",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",
@@ -79,10 +79,7 @@ const actions = {
79
79
  if (authData.manager) {
80
80
  window.localStorage.setItem("managerToken", res.data.data.access_token);
81
81
  window.localStorage.setItem("expires_at", res.data.data.expires_at);
82
- return {
83
- type: 'success',
84
- msg: 'ok'
85
- };
82
+ return res;
86
83
  }
87
84
  window.localStorage.setItem("privateToken", res.data.data.access_token);
88
85
  window.localStorage.setItem("expires_at", res.data.data.expires_at);
@@ -103,10 +100,7 @@ const actions = {
103
100
  }
104
101
  }
105
102
 
106
- return {
107
- type: 'success',
108
- msg: 'ok'
109
- }
103
+ return res
110
104
  })
111
105
  .catch(
112
106
  commonErrorCallback()
@@ -134,7 +128,7 @@ const actions = {
134
128
  ...ordermood
135
129
  });
136
130
  return {
137
- type: 'success',
131
+ ...res,
138
132
  msg: res.data.message.body
139
133
  }
140
134
  })
@@ -225,12 +219,7 @@ const actions = {
225
219
  for (let i = 0; i < baskets.length; i++) {
226
220
  $http
227
221
  .post(`api/basket/unassigned-basket`, { basketId: baskets[i] })
228
- .then(() => {
229
- return {
230
- type: 'success',
231
- msg: 'ok'
232
- };
233
- })
222
+ .then(res => res)
234
223
  .catch(
235
224
  commonErrorCallback()
236
225
  );
@@ -275,7 +264,7 @@ const actions = {
275
264
  .then((res) => {
276
265
  dispatch("fetchUser");
277
266
  return {
278
- type: 'success',
267
+ ...res,
279
268
  msg: res.data.message.body
280
269
  }
281
270
  })
@@ -288,10 +277,7 @@ const actions = {
288
277
  .get(`api/auth/password/reset`, { params: { token: token } })
289
278
  .then((res) => {
290
279
  commit('setEmail', res.data.data.email);
291
- return {
292
- type: "success",
293
- msg: 'ok'
294
- }
280
+ return res
295
281
  })
296
282
  .catch(
297
283
  commonErrorCallback()
@@ -308,7 +294,7 @@ const actions = {
308
294
  .then((res) => {
309
295
  // dispatch("fetchUser");
310
296
  return {
311
- type: 'success',
297
+ ...res,
312
298
  msg: 'your password has successfully changed'
313
299
  }
314
300
 
@@ -321,13 +307,13 @@ const actions = {
321
307
  update({ commit }, userData) {
322
308
  return $http.post('api/auth/user/update', null, {
323
309
  params: userData
324
- }).then(result => {
310
+ }).then(res => {
325
311
  commit('updateUser', {
326
312
  ...userData,
327
313
  updated_at: new Date().toISOString() // has a little difference with server
328
314
  });
329
315
  return {
330
- type: 'success',
316
+ ...res,
331
317
  msg: result.data.message.body
332
318
  }
333
319
  }).catch(
@@ -337,10 +323,7 @@ const actions = {
337
323
  getUserAddress({ commit }) {
338
324
  return $http.get('api/auth/user/address').then((res) => {
339
325
  commit('setUserAddress', res.data.data);
340
- return {
341
- type: 'success',
342
- msg: 'ok'
343
- }
326
+ return res
344
327
  }).catch(
345
328
  commonErrorCallback()
346
329
  );
@@ -349,7 +332,7 @@ const actions = {
349
332
  return $http.post('api/auth/user/address/add', data).then((res) => {
350
333
  dispatch('getUserAddress')
351
334
  return {
352
- type: 'success',
335
+ ...res,
353
336
  msg: res.data.message.body
354
337
  }
355
338
  }).catch(
@@ -360,7 +343,7 @@ const actions = {
360
343
  return $http.put('api/auth/user/address/remove', { id }).then((res) => {
361
344
  dispatch('getUserAddress')
362
345
  return {
363
- type: 'success',
346
+ ...res,
364
347
  msg: res.data.message.body
365
348
  }
366
349
  }).catch(
@@ -371,7 +354,7 @@ const actions = {
371
354
  return $http.post('api/auth/user/address/edit', data).then((res) => {
372
355
  dispatch('getUserAddress')
373
356
  return {
374
- type: 'success',
357
+ ...res,
375
358
  msg: res.data.message.body
376
359
  }
377
360
  }).catch(
@@ -385,4 +368,4 @@ export default {
385
368
  state,
386
369
  mutations,
387
370
  actions
388
- };
371
+ };
@@ -165,12 +165,7 @@ const actions = {
165
165
  ...table,
166
166
  qrcode: data.qrcode,
167
167
  })
168
- .then((res) => {
169
- return {
170
- type: "success",
171
- msg: "ok",
172
- };
173
- })
168
+ .then(res => res)
174
169
  .catch(commonErrorCallback());
175
170
  },
176
171
  addToBasket({ dispatch, rootState }, data) {
@@ -552,12 +547,7 @@ const actions = {
552
547
  date: rootState.orderiomApiPackage.product.deliveryTime,
553
548
  },
554
549
  })
555
- .then((res) => {
556
- return {
557
- type: "success",
558
- msg: "ok",
559
- };
560
- })
550
+ .then(res => res)
561
551
  .catch(commonErrorCallback());
562
552
  },
563
553
  removeElement({}, data) {
@@ -636,10 +626,7 @@ const actions = {
636
626
  window.location = res.data.data.paymentLink;
637
627
  }
638
628
 
639
- return {
640
- type: "success",
641
- msg: "ok",
642
- };
629
+ return res;
643
630
  }).catch(error => {
644
631
  const status = error.response ? error.response.status : null;
645
632
  if (status === 422) {
@@ -686,10 +673,7 @@ const actions = {
686
673
  commit("product/SetShoppingCart", [], { root: true });
687
674
  commit("product/setDeliveryTime", "", { root: true });
688
675
  commit("product/SetTotalPrice", "0.00", { root: true });
689
- return {
690
- type: "success",
691
- msg: "ok",
692
- };
676
+ return res;
693
677
  })
694
678
  .catch(commonErrorCallback());
695
679
  },
@@ -702,7 +686,7 @@ const actions = {
702
686
  })
703
687
  .then((res) => {
704
688
  return {
705
- type: "success",
689
+ ...res,
706
690
  msg: res.data.message.body,
707
691
  };
708
692
  })
@@ -745,10 +729,7 @@ const actions = {
745
729
  commit("setpaymentStatus", status);
746
730
  // if (status == "paid") {
747
731
  // dispatch('createOrder', data.basketId)
748
- return {
749
- type: "success",
750
- msg: "ok",
751
- };
732
+ return res;
752
733
  // }
753
734
  // return {
754
735
  // type: 'error',
@@ -799,10 +780,7 @@ const actions = {
799
780
  commit("product/setTotalWithDiscount", value, { root: true });
800
781
  }
801
782
 
802
- return {
803
- type: "success",
804
- msg: "",
805
- };
783
+ return res;
806
784
  })
807
785
  .catch(commonErrorCallback());
808
786
  },
@@ -833,10 +811,7 @@ const actions = {
833
811
  })
834
812
  .then((res) => {
835
813
  commit("setTotalPrice", res.data.data.totalPrice);
836
- return {
837
- type: "success",
838
- msg: "ok",
839
- };
814
+ return res;
840
815
  })
841
816
  .catch(commonErrorCallback());
842
817
  },
@@ -869,10 +844,9 @@ const actions = {
869
844
  deliveryType: data.deliveryType,
870
845
  duration: data.duration || undefined,
871
846
  restaurantId: data.restaurantId,
872
- }).then(() => {
847
+ }).then(res => {
873
848
  dispatch("product/getBasket", data.restaurantId, {root: true});
874
-
875
- return {type: "success", msg: ""};
849
+ return res;
876
850
  }).catch(error => {
877
851
  const status = error.response ? error.response.status : null;
878
852
  if (status === 422) {
@@ -946,11 +920,11 @@ const actions = {
946
920
  basketId,
947
921
  },
948
922
  })
949
- .then((result) => {
923
+ .then((res) => {
950
924
  dispatch("product/getBasket", data.restaurantId, { root: true });
951
925
  return {
952
- type: "success",
953
- msg: result.message,
926
+ ...res,
927
+ msg: res.message,
954
928
  };
955
929
  })
956
930
  .catch(commonErrorCallback());
@@ -974,10 +948,10 @@ const actions = {
974
948
  restaurantId: restaurantId,
975
949
  },
976
950
  })
977
- .then((result) => {
951
+ .then((res) => {
978
952
  dispatch("product/getBasket", restaurantId, { root: true });
979
953
  return {
980
- type: "success",
954
+ ...res,
981
955
  msg: "removed",
982
956
  };
983
957
  })
@@ -1001,10 +975,10 @@ const actions = {
1001
975
  restaurantId: data.restaurantId,
1002
976
  tip_price: data.tip_price,
1003
977
  })
1004
- .then((result) => {
978
+ .then((res) => {
1005
979
  dispatch("product/getBasket", data.restaurantId, { root: true });
1006
980
  return {
1007
- type: "success",
981
+ ...res,
1008
982
  msg: "removed",
1009
983
  };
1010
984
  })
@@ -1027,10 +1001,10 @@ const actions = {
1027
1001
  basketId,
1028
1002
  restaurantId: restaurantId,
1029
1003
  })
1030
- .then((result) => {
1004
+ .then((res) => {
1031
1005
  dispatch("product/getBasket", restaurantId, { root: true });
1032
1006
  return {
1033
- type: "success",
1007
+ ...res,
1034
1008
  msg: "removed",
1035
1009
  };
1036
1010
  })
@@ -1055,12 +1029,7 @@ const actions = {
1055
1029
  basketId,
1056
1030
  },
1057
1031
  })
1058
- .then((result) => {
1059
- return {
1060
- type: "success",
1061
- msg: "ok",
1062
- };
1063
- })
1032
+ .then(res => res)
1064
1033
  .catch(commonErrorCallback());
1065
1034
  },
1066
1035
  editCartProductExtraInfo({ rootState, commit }, data) {
@@ -1149,10 +1118,7 @@ const actions = {
1149
1118
  })
1150
1119
  .then((res) => {
1151
1120
  window.location = res.data.data.paymentLink;
1152
- return {
1153
- type: "success",
1154
- msg: "ok",
1155
- };
1121
+ return res;
1156
1122
  })
1157
1123
  .catch(commonErrorCallback());
1158
1124
  },
@@ -1164,10 +1130,7 @@ const actions = {
1164
1130
  .then((res) => {
1165
1131
  const status = res.data.data.status;
1166
1132
  commit("setTablePaymentStatus", status);
1167
- return {
1168
- type: "success",
1169
- msg: "ok",
1170
- };
1133
+ return res;
1171
1134
  })
1172
1135
  .catch(commonErrorCallback());
1173
1136
  },
@@ -1176,10 +1139,7 @@ const actions = {
1176
1139
  .get(`/api/table-payments`, { params: { tablePaymentId } })
1177
1140
  .then((res) => {
1178
1141
  commit("setExternalTableOrdersFromPayment", res.data.data);
1179
- return {
1180
- type: "success",
1181
- msg: "ok",
1182
- };
1142
+ return res;
1183
1143
  })
1184
1144
  .catch(commonErrorCallback());
1185
1145
  },
@@ -306,10 +306,7 @@ const actions = {
306
306
  });
307
307
  }
308
308
  });
309
- return {
310
- type: 'success',
311
- msg: 'ok'
312
- }
309
+ return res
313
310
  })
314
311
  .catch(
315
312
  commonErrorCallback()
@@ -342,7 +339,7 @@ const actions = {
342
339
  productInCategory.quantity = quantity;
343
340
  });
344
341
  commit("setProduct", res.data.data);
345
- return { type: 'success', data: res.data.data }
342
+ return { ...res, data: res.data.data }
346
343
  }).catch(
347
344
  commonErrorCallback()
348
345
  );
@@ -382,7 +379,7 @@ const actions = {
382
379
  } else {
383
380
  commit("setShowPinnedProducts", false);
384
381
  }
385
- return { type: 'success', data: res.data.data }
382
+ return { ...res, data: res.data.data }
386
383
  }).catch(
387
384
  commonErrorCallback()
388
385
  );
@@ -454,12 +451,11 @@ const actions = {
454
451
  restaurantId: data.restaurantId,
455
452
  basketId: basketId
456
453
  }
457
- }).then((result) => {
458
- commit('setProductPackage', result.data.data)
454
+ }).then((res) => {
455
+ commit('setProductPackage', res.data.data)
459
456
  return {
460
- type: 'success',
461
- msg: '',
462
- data: result.data.data
457
+ ...res,
458
+ data: res.data.data
463
459
  }
464
460
  }).catch(
465
461
  commonErrorCallback()
@@ -581,18 +577,10 @@ const actions = {
581
577
  }
582
578
  })
583
579
  },
584
- fetchMostSelling({ commit }, data) {
585
- return $http.get('api/restaurant/most-selling', {
586
- params: data
587
- }).then((res) => {
588
- return {
589
- type: 'success',
590
- message: '',
591
- data: res.data
592
- }
593
- }).catch(
594
- commonErrorCallback()
595
- );
580
+ fetchMostSelling({ commit }, params) {
581
+ return $http.get('api/restaurant/most-selling', { params })
582
+ .then(res => res)
583
+ .catch(commonErrorCallback());
596
584
  },
597
585
  };
598
586
 
@@ -71,10 +71,7 @@ const actions = {
71
71
  }
72
72
  }).then(res => {
73
73
  commit('setRestaurants', res.data.data)
74
- return {
75
- type: 'success',
76
- msg: 'ok'
77
- }
74
+ return res
78
75
  }).catch(error => {
79
76
  commit('setRestaurants', [])
80
77
  return commonErrorCallback()(error);
@@ -102,9 +99,9 @@ const actions = {
102
99
  );
103
100
  },
104
101
  contact({ }, data) {
105
- return $http.post('api/contact', data).then((result) => {
102
+ return $http.post('api/contact', data).then((res) => {
106
103
  return {
107
- type: 'success',
104
+ ...res,
108
105
  msg: 'your message has been delivered successfully!'
109
106
  }
110
107
  }).catch(
@@ -123,7 +120,7 @@ const actions = {
123
120
  params: data
124
121
  }).then((res) => {
125
122
  return {
126
- type: 'success',
123
+ ...res,
127
124
  msg: res.data.message.body
128
125
  }
129
126
  }).catch(
@@ -135,18 +132,15 @@ const actions = {
135
132
  params: {
136
133
  restaurantId: restaurantId
137
134
  }
138
- }).then((result) => {
139
- commit('setTables', result.data.data);
140
- return {
141
- type: 'success',
142
- msg: 'ok'
143
- }
135
+ }).then((res) => {
136
+ commit('setTables', res.data.data);
137
+ return res
144
138
  }).catch(
145
139
  commonErrorCallback()
146
140
  );
147
141
  },
148
142
  addReservedTables({ commit }, data) {
149
- return $http
143
+ return $http
150
144
  .post("api/restaurant/reserve-table", {
151
145
  restaurantId: data.restaurantId,
152
146
  people: data.people,
@@ -155,12 +149,9 @@ const actions = {
155
149
  email: data.email,
156
150
  name: data.name,
157
151
  phone: data.phone,
158
- }).then((result) => {
159
- commit('setReservedTables', result.data.data);
160
- return {
161
- type: 'success',
162
- msg: ''
163
- }
152
+ }).then((res) => {
153
+ commit('setReservedTables', res.data.data);
154
+ return res
164
155
  }).catch(
165
156
  commonErrorCallback('There was an error in adding reserved tables')
166
157
  );
@@ -170,10 +161,7 @@ const actions = {
170
161
  params: restaurantId
171
162
  }).then(res => {
172
163
  commit('setBlogs', res.data.data)
173
- return {
174
- type: 'success',
175
- msg: 'ok'
176
- }
164
+ return res
177
165
  }).catch(error => {
178
166
  commit('setBlogs', [])
179
167
  return commonErrorCallback()(error);
@@ -189,8 +177,7 @@ const actions = {
189
177
  }).then(res => {
190
178
  commit('setBlogs', res.data.data)
191
179
  return {
192
- type: 'success',
193
- msg: '',
180
+ ...res,
194
181
  tagName: res.data.meta.searched_tag.name
195
182
  }
196
183
  }).catch(error => {
@@ -216,10 +203,7 @@ const actions = {
216
203
  params: blogId
217
204
  }).then(res => {
218
205
  commit('setBlog', res.data.data)
219
- return {
220
- type: 'success',
221
- msg: 'ok'
222
- }
206
+ return res
223
207
  }).catch(error => {
224
208
  commit('setBlog', [])
225
209
  return commonErrorCallback()(error);
@@ -233,7 +217,7 @@ const actions = {
233
217
  }
234
218
  }).then(res => {
235
219
  commit('setBlog', res.data.data);
236
- return { type: 'success', msg: 'ok' }
220
+ return res
237
221
  }).catch(error => {
238
222
  commit('setBlog', []);
239
223
  return commonErrorCallback()(error);
@@ -244,10 +228,7 @@ const actions = {
244
228
  params: data
245
229
  }).then(res => {
246
230
  commit('setTestimonials', res.data.data)
247
- return {
248
- type: 'success',
249
- msg: 'ok'
250
- }
231
+ return res
251
232
  }).catch(error => {
252
233
  commit('setTestimonials', []);
253
234
  return commonErrorCallback()(error);
@@ -262,17 +243,9 @@ const actions = {
262
243
  })
263
244
  },
264
245
  getPostalCodes({commit}, restaurantId){
265
- return $http.get('api/restaurant/postalCodes',{
266
- params:{
267
- restaurantId
268
- }
269
- }).then(res=>{
270
- return {
271
- type: 'success',
272
- msg: '',
273
- data: res.data
274
- };
275
- }).catch(commonErrorCallback())
246
+ return $http.get('api/restaurant/postalCodes',{params:{restaurantId}})
247
+ .then(res => res)
248
+ .catch(commonErrorCallback())
276
249
  }
277
250
  }
278
251
  export default {
@@ -280,4 +253,4 @@ export default {
280
253
  state,
281
254
  mutations,
282
255
  actions
283
- };
256
+ };