orderiom-api-package 0.2.51 → 0.2.52
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 +2 -2
- package/src/common.js +39 -0
- package/src/modules/auth.js +55 -350
- package/src/modules/manager.js +1 -0
- package/src/modules/order.js +64 -431
- package/src/modules/product.js +19 -135
- package/src/modules/restaurant.js +29 -235
package/src/modules/order.js
CHANGED
|
@@ -1,42 +1,5 @@
|
|
|
1
1
|
import axios from "axios";
|
|
2
|
-
|
|
3
|
-
const restaurantId = process.env.VUE_APP_RESTAURANT_ID;
|
|
4
|
-
|
|
5
|
-
function calculateBasketIdParameter(isLogin) {
|
|
6
|
-
if(isLogin) return undefined;
|
|
7
|
-
// localStorage might fail
|
|
8
|
-
let baskets = [];
|
|
9
|
-
try{
|
|
10
|
-
baskets = JSON.parse(localStorage.getItem("basket")) || [];
|
|
11
|
-
}catch(e){
|
|
12
|
-
console.error(e);
|
|
13
|
-
throw new Error('Basket not found');
|
|
14
|
-
}
|
|
15
|
-
const foundBasket = baskets.find(basket => basket.restaurantId === restaurantId);
|
|
16
|
-
if(!foundBasket){
|
|
17
|
-
throw new Error('Basket not found');
|
|
18
|
-
}
|
|
19
|
-
return foundBasket.basketId;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
function commonErrorCallback(error){
|
|
23
|
-
const status = error.response ? error.response.status : null;
|
|
24
|
-
if (status === 422) {
|
|
25
|
-
return {
|
|
26
|
-
type: 'error',
|
|
27
|
-
msg: Object.values(error.response.data.error.validation).map(m => m[0]).toString()
|
|
28
|
-
}
|
|
29
|
-
} else if ([401, 403, 404, 400].includes(status)) {
|
|
30
|
-
return {
|
|
31
|
-
type: 'error',
|
|
32
|
-
msg: error.response.data.message.body
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
return {
|
|
36
|
-
type: 'error',
|
|
37
|
-
msg: 'Something went wrong'
|
|
38
|
-
}
|
|
39
|
-
}
|
|
2
|
+
import { commonErrorCallback, calculateBasketIdParameter, restaurantId } from '../common';
|
|
40
3
|
|
|
41
4
|
const state = () => ({
|
|
42
5
|
productOrder: null,
|
|
@@ -132,26 +95,9 @@ const actions = {
|
|
|
132
95
|
// localStorage.setItem("basketId", res.data.id);
|
|
133
96
|
return true;
|
|
134
97
|
})
|
|
135
|
-
.catch(
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
return {
|
|
139
|
-
type: 'error',
|
|
140
|
-
msg: Object.values(error.response.data.error.validation).map(m => { return m[0] }).toString()
|
|
141
|
-
|
|
142
|
-
}
|
|
143
|
-
}
|
|
144
|
-
if (error.response.status == 401 || error.response.status == 403 || error.response.status == 404 || error.response.status == 400) {
|
|
145
|
-
|
|
146
|
-
return {
|
|
147
|
-
type: 'error',
|
|
148
|
-
msg: error.response.data.message.body
|
|
149
|
-
|
|
150
|
-
}
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
}
|
|
154
|
-
});
|
|
98
|
+
.catch(
|
|
99
|
+
commonErrorCallback()
|
|
100
|
+
);
|
|
155
101
|
},
|
|
156
102
|
createBasketFromOrder({ dispatch }, data) {
|
|
157
103
|
const basketData = JSON.parse(localStorage.getItem("basket") || "[]");
|
|
@@ -169,31 +115,9 @@ const actions = {
|
|
|
169
115
|
msg: result ? 'Basket created' : 'There was an error in fetching the basket info',
|
|
170
116
|
}
|
|
171
117
|
})
|
|
172
|
-
.catch(
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
type: 'error',
|
|
176
|
-
msg: 'There was an error in creating basket',
|
|
177
|
-
}
|
|
178
|
-
}
|
|
179
|
-
const status = error.response.status;
|
|
180
|
-
if (status === 422) {
|
|
181
|
-
return {
|
|
182
|
-
type: 'error',
|
|
183
|
-
msg: Object.values(error.response.data.error.validation).map(m => { return m[0] }).toString()
|
|
184
|
-
}
|
|
185
|
-
}
|
|
186
|
-
if ([401, 403, 404, 400].includes(status)) {
|
|
187
|
-
return {
|
|
188
|
-
type: 'error',
|
|
189
|
-
msg: error.response.data.message.body
|
|
190
|
-
}
|
|
191
|
-
}
|
|
192
|
-
return {
|
|
193
|
-
type:'error',
|
|
194
|
-
msg:'There was an error in creating basket'
|
|
195
|
-
}
|
|
196
|
-
});
|
|
118
|
+
.catch(
|
|
119
|
+
commonErrorCallback('There was an error in creating basket')
|
|
120
|
+
);
|
|
197
121
|
},
|
|
198
122
|
setTable({ rootState }, data) {
|
|
199
123
|
const basket = JSON.parse(localStorage.getItem("basket"));
|
|
@@ -221,26 +145,9 @@ const actions = {
|
|
|
221
145
|
type: 'success',
|
|
222
146
|
msg: 'ok'
|
|
223
147
|
}
|
|
224
|
-
}).catch(
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
return {
|
|
228
|
-
type: 'error',
|
|
229
|
-
msg: Object.values(error.response.data.error.validation).map(m => { return m[0] }).toString()
|
|
230
|
-
|
|
231
|
-
}
|
|
232
|
-
}
|
|
233
|
-
if (error.response.status == 401 || error.response.status == 403 || error.response.status == 404 || error.response.status == 400) {
|
|
234
|
-
|
|
235
|
-
return {
|
|
236
|
-
type: 'error',
|
|
237
|
-
msg: error.response.data.message.body
|
|
238
|
-
|
|
239
|
-
}
|
|
240
|
-
}
|
|
241
|
-
|
|
242
|
-
}
|
|
243
|
-
});
|
|
148
|
+
}).catch(
|
|
149
|
+
commonErrorCallback()
|
|
150
|
+
);
|
|
244
151
|
},
|
|
245
152
|
addToBasket({ dispatch, rootState }, data) {
|
|
246
153
|
// might be null
|
|
@@ -264,7 +171,7 @@ const actions = {
|
|
|
264
171
|
}).then(async () => {
|
|
265
172
|
return await dispatch('shoppingCartUpdateCallback', { restaurantId: data.restaurantId });
|
|
266
173
|
}).catch(
|
|
267
|
-
commonErrorCallback
|
|
174
|
+
commonErrorCallback()
|
|
268
175
|
).finally(() => {
|
|
269
176
|
if(basketProduct) basketProduct.changingQuantity = false;
|
|
270
177
|
});
|
|
@@ -296,7 +203,7 @@ const actions = {
|
|
|
296
203
|
}).then(async () => {
|
|
297
204
|
return await dispatch('shoppingCartUpdateCallback', { restaurantId: data.restaurantId });
|
|
298
205
|
}).catch(
|
|
299
|
-
commonErrorCallback
|
|
206
|
+
commonErrorCallback()
|
|
300
207
|
).finally(() => {
|
|
301
208
|
basketProduct.changingQuantity = false;
|
|
302
209
|
});
|
|
@@ -329,7 +236,7 @@ const actions = {
|
|
|
329
236
|
}).then(async () => {
|
|
330
237
|
return await dispatch('shoppingCartUpdateCallback', { restaurantId: data.restaurantId });
|
|
331
238
|
}).catch(
|
|
332
|
-
commonErrorCallback
|
|
239
|
+
commonErrorCallback()
|
|
333
240
|
).finally(() => {
|
|
334
241
|
basketProduct.changingQuantity = false;
|
|
335
242
|
});
|
|
@@ -361,7 +268,7 @@ const actions = {
|
|
|
361
268
|
}).then(async () => {
|
|
362
269
|
return await dispatch('shoppingCartUpdateCallback', { restaurantId: data.restaurantId });
|
|
363
270
|
}).catch(
|
|
364
|
-
commonErrorCallback
|
|
271
|
+
commonErrorCallback()
|
|
365
272
|
).finally(() => {
|
|
366
273
|
basketProduct.deleting = false;
|
|
367
274
|
});
|
|
@@ -394,7 +301,7 @@ const actions = {
|
|
|
394
301
|
}).then(async () => {
|
|
395
302
|
return await dispatch('shoppingCartUpdateCallback', { restaurantId: data.restaurantId });
|
|
396
303
|
}).catch(
|
|
397
|
-
commonErrorCallback
|
|
304
|
+
commonErrorCallback()
|
|
398
305
|
).finally(() => {
|
|
399
306
|
basketProduct.deleting = false;
|
|
400
307
|
});
|
|
@@ -423,7 +330,7 @@ const actions = {
|
|
|
423
330
|
}).then(async () => {
|
|
424
331
|
return await dispatch('shoppingCartUpdateCallback', { restaurantId: data.restaurantId });
|
|
425
332
|
}).catch(
|
|
426
|
-
commonErrorCallback
|
|
333
|
+
commonErrorCallback()
|
|
427
334
|
).finally(() => {
|
|
428
335
|
basketProduct.changingQuantity = false;
|
|
429
336
|
});
|
|
@@ -442,25 +349,9 @@ const actions = {
|
|
|
442
349
|
.then(() => {
|
|
443
350
|
return true;
|
|
444
351
|
})
|
|
445
|
-
.catch(
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
return {
|
|
449
|
-
type: 'error',
|
|
450
|
-
msg: Object.values(error.response.data.error.validation).map(m => { return m[0] }).toString()
|
|
451
|
-
|
|
452
|
-
}
|
|
453
|
-
}
|
|
454
|
-
if (error.response.status == 401 || error.response.status == 403 || error.response.status == 404 || error.response.status == 400) {
|
|
455
|
-
return {
|
|
456
|
-
type: 'error',
|
|
457
|
-
msg: error.response.data.message.body
|
|
458
|
-
|
|
459
|
-
}
|
|
460
|
-
}
|
|
461
|
-
|
|
462
|
-
}
|
|
463
|
-
});
|
|
352
|
+
.catch(
|
|
353
|
+
commonErrorCallback()
|
|
354
|
+
);
|
|
464
355
|
},
|
|
465
356
|
checkAddress({ rootState }, data) {
|
|
466
357
|
const basket = JSON.parse(localStorage.getItem("basket"));
|
|
@@ -483,26 +374,9 @@ const actions = {
|
|
|
483
374
|
msg: 'ok'
|
|
484
375
|
}
|
|
485
376
|
})
|
|
486
|
-
.catch(
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
return {
|
|
490
|
-
type: 'error',
|
|
491
|
-
msg: Object.values(error.response.data.error.validation).map(m => { return m[0] }).toString()
|
|
492
|
-
|
|
493
|
-
}
|
|
494
|
-
}
|
|
495
|
-
if (error.response.status == 401 || error.response.status == 403 || error.response.status == 404 || error.response.status == 400) {
|
|
496
|
-
return {
|
|
497
|
-
type: 'error',
|
|
498
|
-
msg: error.response.data.message.body
|
|
499
|
-
|
|
500
|
-
}
|
|
501
|
-
}
|
|
502
|
-
|
|
503
|
-
}
|
|
504
|
-
console.clear()
|
|
505
|
-
});
|
|
377
|
+
.catch(
|
|
378
|
+
commonErrorCallback()
|
|
379
|
+
);
|
|
506
380
|
},
|
|
507
381
|
removeElement({ }, data) {
|
|
508
382
|
var index = data.array.indexOf(data.item);
|
|
@@ -547,25 +421,9 @@ const actions = {
|
|
|
547
421
|
msg: 'ok'
|
|
548
422
|
}
|
|
549
423
|
})
|
|
550
|
-
.catch(
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
return {
|
|
554
|
-
type: 'error',
|
|
555
|
-
msg: Object.values(error.response.data.error.validation).map(m => { return m[0] }).toString()
|
|
556
|
-
|
|
557
|
-
}
|
|
558
|
-
}
|
|
559
|
-
if (error.response.status == 401 || error.response.status == 403 || error.response.status == 404 || error.response.status == 400) {
|
|
560
|
-
return {
|
|
561
|
-
type: 'error',
|
|
562
|
-
msg: error.response.data.message.body
|
|
563
|
-
|
|
564
|
-
}
|
|
565
|
-
}
|
|
566
|
-
|
|
567
|
-
}
|
|
568
|
-
});
|
|
424
|
+
.catch(
|
|
425
|
+
commonErrorCallback()
|
|
426
|
+
);
|
|
569
427
|
},
|
|
570
428
|
getOrder({ commit }, orderId) {
|
|
571
429
|
return axios
|
|
@@ -590,27 +448,9 @@ const actions = {
|
|
|
590
448
|
msg: "ok"
|
|
591
449
|
}
|
|
592
450
|
})
|
|
593
|
-
.catch(
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
return {
|
|
597
|
-
type: 'error',
|
|
598
|
-
msg: Object.values(error.response.data.error.validation).map(m => { return m[0] }).toString()
|
|
599
|
-
|
|
600
|
-
}
|
|
601
|
-
}
|
|
602
|
-
if (error.response.status == 401 || error.response.status == 403 || error.response.status == 404 || error.response.status == 400) {
|
|
603
|
-
|
|
604
|
-
return {
|
|
605
|
-
type: 'error',
|
|
606
|
-
msg: error.response.data.message.body
|
|
607
|
-
|
|
608
|
-
}
|
|
609
|
-
}
|
|
610
|
-
|
|
611
|
-
}
|
|
612
|
-
});
|
|
613
|
-
|
|
451
|
+
.catch(
|
|
452
|
+
commonErrorCallback()
|
|
453
|
+
);
|
|
614
454
|
},
|
|
615
455
|
requestBill({ }, orderId) {
|
|
616
456
|
return axios
|
|
@@ -625,26 +465,9 @@ const actions = {
|
|
|
625
465
|
msg: res.data.message.body
|
|
626
466
|
}
|
|
627
467
|
})
|
|
628
|
-
.catch(
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
return {
|
|
632
|
-
type: 'error',
|
|
633
|
-
msg: Object.values(error.response.data.error.validation).map(m => { return m[0] }).toString()
|
|
634
|
-
|
|
635
|
-
}
|
|
636
|
-
}
|
|
637
|
-
if (error.response.status == 401 || error.response.status == 403 || error.response.status == 404 || error.response.status == 400) {
|
|
638
|
-
|
|
639
|
-
return {
|
|
640
|
-
type: 'error',
|
|
641
|
-
msg: error.response.data.message.body
|
|
642
|
-
|
|
643
|
-
}
|
|
644
|
-
}
|
|
645
|
-
|
|
646
|
-
}
|
|
647
|
-
});
|
|
468
|
+
.catch(
|
|
469
|
+
commonErrorCallback()
|
|
470
|
+
);
|
|
648
471
|
|
|
649
472
|
},
|
|
650
473
|
preparePayment({ rootState }, data) {
|
|
@@ -661,26 +484,9 @@ const actions = {
|
|
|
661
484
|
}
|
|
662
485
|
}).then((result) => {
|
|
663
486
|
window.location = result.data.data.mollieLink;
|
|
664
|
-
}).catch(
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
return {
|
|
668
|
-
type: 'error',
|
|
669
|
-
msg: Object.values(error.response.data.error.validation).map(m => { return m[0] }).toString()
|
|
670
|
-
|
|
671
|
-
}
|
|
672
|
-
}
|
|
673
|
-
if (error.response.status == 401 || error.response.status == 403 || error.response.status == 404 || error.response.status == 400) {
|
|
674
|
-
|
|
675
|
-
return {
|
|
676
|
-
type: 'error',
|
|
677
|
-
msg: error.response.data.message.body
|
|
678
|
-
|
|
679
|
-
}
|
|
680
|
-
}
|
|
681
|
-
|
|
682
|
-
}
|
|
683
|
-
});
|
|
487
|
+
}).catch(
|
|
488
|
+
commonErrorCallback()
|
|
489
|
+
);
|
|
684
490
|
},
|
|
685
491
|
updatePaymentStatus({ dispatch, commit }, data) {
|
|
686
492
|
return axios
|
|
@@ -700,26 +506,9 @@ const actions = {
|
|
|
700
506
|
// msg: 'ok'
|
|
701
507
|
// }
|
|
702
508
|
})
|
|
703
|
-
.catch(
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
return {
|
|
707
|
-
type: 'error',
|
|
708
|
-
msg: Object.values(error.response.data.error.validation).map(m => { return m[0] }).toString()
|
|
709
|
-
|
|
710
|
-
}
|
|
711
|
-
}
|
|
712
|
-
if (error.response.status == 401 || error.response.status == 403 || error.response.status == 404 || error.response.status == 400) {
|
|
713
|
-
|
|
714
|
-
return {
|
|
715
|
-
type: 'error',
|
|
716
|
-
msg: error.response.data.message.body
|
|
717
|
-
|
|
718
|
-
}
|
|
719
|
-
}
|
|
720
|
-
|
|
721
|
-
}
|
|
722
|
-
});
|
|
509
|
+
.catch(
|
|
510
|
+
commonErrorCallback()
|
|
511
|
+
);
|
|
723
512
|
},
|
|
724
513
|
getShippingPrice({ commit, rootState }, data) {
|
|
725
514
|
let basketId = undefined;
|
|
@@ -748,27 +537,9 @@ const actions = {
|
|
|
748
537
|
msg: 'ok'
|
|
749
538
|
}
|
|
750
539
|
})
|
|
751
|
-
.catch(
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
return {
|
|
755
|
-
type: 'error',
|
|
756
|
-
msg: Object.values(error.response.data.error.validation).map(m => { return m[0] }).toString()
|
|
757
|
-
|
|
758
|
-
}
|
|
759
|
-
}
|
|
760
|
-
if (error.response.status == 401 || error.response.status == 403 || error.response.status == 404 || error.response.status == 400) {
|
|
761
|
-
|
|
762
|
-
return {
|
|
763
|
-
type: 'error',
|
|
764
|
-
msg: error.response.data.message.body
|
|
765
|
-
|
|
766
|
-
}
|
|
767
|
-
}
|
|
768
|
-
|
|
769
|
-
}
|
|
770
|
-
console.clear();
|
|
771
|
-
});
|
|
540
|
+
.catch(
|
|
541
|
+
commonErrorCallback()
|
|
542
|
+
);
|
|
772
543
|
},
|
|
773
544
|
getTotalPrice({ commit, rootState }, data) {
|
|
774
545
|
const basket = JSON.parse(localStorage.getItem("basket"));
|
|
@@ -794,27 +565,9 @@ const actions = {
|
|
|
794
565
|
msg: 'ok'
|
|
795
566
|
}
|
|
796
567
|
})
|
|
797
|
-
.catch(
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
return {
|
|
801
|
-
type: 'error',
|
|
802
|
-
msg: Object.values(error.response.data.error.validation).map(m => { return m[0] }).toString()
|
|
803
|
-
|
|
804
|
-
}
|
|
805
|
-
}
|
|
806
|
-
if (error.response.status == 401 || error.response.status == 403 || error.response.status == 404 || error.response.status == 400) {
|
|
807
|
-
|
|
808
|
-
return {
|
|
809
|
-
type: 'error',
|
|
810
|
-
msg: error.response.data.message.body
|
|
811
|
-
|
|
812
|
-
}
|
|
813
|
-
}
|
|
814
|
-
|
|
815
|
-
}
|
|
816
|
-
console.clear();
|
|
817
|
-
});
|
|
568
|
+
.catch(
|
|
569
|
+
commonErrorCallback()
|
|
570
|
+
);
|
|
818
571
|
},
|
|
819
572
|
addDeliveryTimeToBasket({ dispatch, rootState }, data) {
|
|
820
573
|
const basket = JSON.parse(localStorage.getItem("basket"));
|
|
@@ -837,26 +590,9 @@ const actions = {
|
|
|
837
590
|
msg: 'ok'
|
|
838
591
|
}
|
|
839
592
|
})
|
|
840
|
-
.catch(
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
return {
|
|
844
|
-
type: 'error',
|
|
845
|
-
msg: Object.values(error.response.data.error.validation).map(m => { return m[0] }).toString()
|
|
846
|
-
|
|
847
|
-
}
|
|
848
|
-
}
|
|
849
|
-
if (error.response.status == 401 || error.response.status == 403 || error.response.status == 404 || error.response.status == 400) {
|
|
850
|
-
|
|
851
|
-
return {
|
|
852
|
-
type: 'error',
|
|
853
|
-
msg: error.response.data.message.body
|
|
854
|
-
|
|
855
|
-
}
|
|
856
|
-
}
|
|
857
|
-
|
|
858
|
-
}
|
|
859
|
-
});
|
|
593
|
+
.catch(
|
|
594
|
+
commonErrorCallback()
|
|
595
|
+
);
|
|
860
596
|
},
|
|
861
597
|
getOrderHistory({ commit }, data) {
|
|
862
598
|
return axios
|
|
@@ -864,27 +600,9 @@ const actions = {
|
|
|
864
600
|
.then((res) => {
|
|
865
601
|
commit('setorderList', res.data.data)
|
|
866
602
|
})
|
|
867
|
-
.catch(
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
return {
|
|
871
|
-
type: 'error',
|
|
872
|
-
msg: Object.values(error.response.data.error.validation).map(m => { return m[0] }).toString()
|
|
873
|
-
|
|
874
|
-
}
|
|
875
|
-
}
|
|
876
|
-
if (error.response.status == 401 || error.response.status == 403 || error.response.status == 404 || error.response.status == 400) {
|
|
877
|
-
|
|
878
|
-
return {
|
|
879
|
-
type: 'error',
|
|
880
|
-
msg: error.response.data.message.body
|
|
881
|
-
|
|
882
|
-
}
|
|
883
|
-
}
|
|
884
|
-
|
|
885
|
-
}
|
|
886
|
-
console.clear();
|
|
887
|
-
});
|
|
603
|
+
.catch(
|
|
604
|
+
commonErrorCallback()
|
|
605
|
+
);
|
|
888
606
|
},
|
|
889
607
|
addVoucher({ rootState, dispatch }, data) {
|
|
890
608
|
const basket = JSON.parse(localStorage.getItem("basket"));
|
|
@@ -903,26 +621,9 @@ const actions = {
|
|
|
903
621
|
type: 'success',
|
|
904
622
|
msg: result.message
|
|
905
623
|
}
|
|
906
|
-
}).catch(
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
return {
|
|
910
|
-
type: 'error',
|
|
911
|
-
msg: Object.values(error.response.data.error.validation).map(m => { return m[0] }).toString()
|
|
912
|
-
|
|
913
|
-
}
|
|
914
|
-
}
|
|
915
|
-
if (error.response.status == 401 || error.response.status == 403 || error.response.status == 404 || error.response.status == 400) {
|
|
916
|
-
|
|
917
|
-
return {
|
|
918
|
-
type: 'error',
|
|
919
|
-
msg: error.response.data.message.body
|
|
920
|
-
|
|
921
|
-
}
|
|
922
|
-
}
|
|
923
|
-
|
|
924
|
-
}
|
|
925
|
-
});
|
|
624
|
+
}).catch(
|
|
625
|
+
commonErrorCallback()
|
|
626
|
+
);
|
|
926
627
|
},
|
|
927
628
|
removeVoucher({ rootState, dispatch }, restaurantId) {
|
|
928
629
|
const basket = JSON.parse(localStorage.getItem("basket"));
|
|
@@ -940,26 +641,9 @@ const actions = {
|
|
|
940
641
|
type: 'success',
|
|
941
642
|
msg: 'removed'
|
|
942
643
|
}
|
|
943
|
-
}).catch(
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
return {
|
|
947
|
-
type: 'error',
|
|
948
|
-
msg: Object.values(error.response.data.error.validation).map(m => { return m[0] }).toString()
|
|
949
|
-
|
|
950
|
-
}
|
|
951
|
-
}
|
|
952
|
-
if (error.response.status == 401 || error.response.status == 403 || error.response.status == 404 || error.response.status == 400) {
|
|
953
|
-
|
|
954
|
-
return {
|
|
955
|
-
type: 'error',
|
|
956
|
-
msg: error.response.data.message.body
|
|
957
|
-
|
|
958
|
-
}
|
|
959
|
-
}
|
|
960
|
-
|
|
961
|
-
}
|
|
962
|
-
});
|
|
644
|
+
}).catch(
|
|
645
|
+
commonErrorCallback()
|
|
646
|
+
);
|
|
963
647
|
},
|
|
964
648
|
addTip({ rootState, dispatch }, data) {
|
|
965
649
|
const basket = JSON.parse(localStorage.getItem("basket"));
|
|
@@ -976,26 +660,9 @@ const actions = {
|
|
|
976
660
|
type: 'success',
|
|
977
661
|
msg: 'removed'
|
|
978
662
|
}
|
|
979
|
-
}).catch(
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
return {
|
|
983
|
-
type: 'error',
|
|
984
|
-
msg: Object.values(error.response.data.error.validation).map(m => { return m[0] }).toString()
|
|
985
|
-
|
|
986
|
-
}
|
|
987
|
-
}
|
|
988
|
-
if (error.response.status == 401 || error.response.status == 403 || error.response.status == 404 || error.response.status == 400) {
|
|
989
|
-
|
|
990
|
-
return {
|
|
991
|
-
type: 'error',
|
|
992
|
-
msg: error.response.data.message.body
|
|
993
|
-
|
|
994
|
-
}
|
|
995
|
-
}
|
|
996
|
-
|
|
997
|
-
}
|
|
998
|
-
});
|
|
663
|
+
}).catch(
|
|
664
|
+
commonErrorCallback()
|
|
665
|
+
);
|
|
999
666
|
},
|
|
1000
667
|
removeTip({ rootState, dispatch }, restaurantId) {
|
|
1001
668
|
const basket = JSON.parse(localStorage.getItem("basket"));
|
|
@@ -1011,26 +678,9 @@ const actions = {
|
|
|
1011
678
|
type: 'success',
|
|
1012
679
|
msg: 'removed'
|
|
1013
680
|
}
|
|
1014
|
-
}).catch(
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
return {
|
|
1018
|
-
type: 'error',
|
|
1019
|
-
msg: Object.values(error.response.data.error.validation).map(m => { return m[0] }).toString()
|
|
1020
|
-
|
|
1021
|
-
}
|
|
1022
|
-
}
|
|
1023
|
-
if (error.response.status == 401 || error.response.status == 403 || error.response.status == 404 || error.response.status == 400) {
|
|
1024
|
-
|
|
1025
|
-
return {
|
|
1026
|
-
type: 'error',
|
|
1027
|
-
msg: error.response.data.message.body
|
|
1028
|
-
|
|
1029
|
-
}
|
|
1030
|
-
}
|
|
1031
|
-
|
|
1032
|
-
}
|
|
1033
|
-
});
|
|
681
|
+
}).catch(
|
|
682
|
+
commonErrorCallback()
|
|
683
|
+
);
|
|
1034
684
|
},
|
|
1035
685
|
checkOrderValidity({ rootState }, data) {
|
|
1036
686
|
const basket = JSON.parse(localStorage.getItem("basket"));
|
|
@@ -1047,26 +697,9 @@ const actions = {
|
|
|
1047
697
|
type: 'success',
|
|
1048
698
|
msg: 'ok'
|
|
1049
699
|
}
|
|
1050
|
-
}).catch(
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
return {
|
|
1054
|
-
type: 'error',
|
|
1055
|
-
msg: Object.values(error.response.data.error.validation).map(m => { return m[0] }).toString()
|
|
1056
|
-
|
|
1057
|
-
}
|
|
1058
|
-
}
|
|
1059
|
-
if (error.response.status == 401 || error.response.status == 403 || error.response.status == 404 || error.response.status == 400) {
|
|
1060
|
-
|
|
1061
|
-
return {
|
|
1062
|
-
type: 'error',
|
|
1063
|
-
msg: error.response.data.message.body
|
|
1064
|
-
|
|
1065
|
-
}
|
|
1066
|
-
}
|
|
1067
|
-
|
|
1068
|
-
}
|
|
1069
|
-
});
|
|
700
|
+
}).catch(
|
|
701
|
+
commonErrorCallback()
|
|
702
|
+
);
|
|
1070
703
|
}
|
|
1071
704
|
}
|
|
1072
705
|
export default {
|