orderiom-api-package 0.3.30 → 0.3.32

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.30",
3
+ "version": "0.3.32",
4
4
  "description": "This package will install all necessary API calls for every orderiom restaurant",
5
5
  "main": "index.js",
6
6
  "scripts": {
package/src/common.js CHANGED
@@ -85,7 +85,12 @@ axios.interceptors.request.use(config => {
85
85
  axios.interceptors.response.use(response => {
86
86
  return response;
87
87
  }, error => {
88
- if (error.response?.data?.error?.validation) {
88
+ if (
89
+ error.response &&
90
+ error.response.data &&
91
+ error.response.data.error &&
92
+ error.response.data.error.validation
93
+ ) {
89
94
  const validation = error.response.data.error.validation;
90
95
 
91
96
  if (
@@ -103,7 +108,10 @@ axios.interceptors.response.use(response => {
103
108
  }
104
109
 
105
110
  if (
106
- error.response?.data?.message?.body === "unauthenticated" &&
111
+ error.response &&
112
+ error.response.data &&
113
+ error.response.data.message &&
114
+ error.response.data.message.body === "unauthenticated" &&
107
115
  localStorage.getItem("privateToken")
108
116
  ) {
109
117
  localStorage.clear();
@@ -395,9 +395,14 @@ const actions = {
395
395
  // commit('setuserOrder', JSON.parse(res.data.data.order.user_details));
396
396
  // commit('setshippigPriceOrder', res.data.data.order.shipping_price);
397
397
 
398
- if(!data.$router || !data.routeName){
399
- window.location = res.data.data.paymentLink;
400
- }else{
398
+ if(
399
+ (
400
+ res.data.data.paymentLink.includes("/paymentstatus/?") ||
401
+ res.data.data.paymentLink.includes("/paymentstatus?")
402
+ ) &&
403
+ data.$router &&
404
+ data.routeName
405
+ ){
401
406
  data.$router.push({
402
407
  name: data.routeName,
403
408
  query: res.data.data.paymentLink
@@ -410,6 +415,8 @@ const actions = {
410
415
  return result;
411
416
  }, {})
412
417
  });
418
+ } else {
419
+ window.location = res.data.data.paymentLink;
413
420
  }
414
421
 
415
422
  var index = data.basket ? basketData.indexOf(basketData.find((item) => item.basketId == data.basket)) :