orderiom-api-package 0.2.50 → 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 +197 -633
- package/src/modules/product.js +19 -135
- package/src/modules/restaurant.js +29 -235
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "orderiom-api-package",
|
|
3
|
-
"version": "0.2.
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "0.2.52",
|
|
4
|
+
"description": "This package will install all necessary API calls for every orderiom restaurant",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
7
7
|
"test": "echo \"Error: no test specified\" && exit 1"
|
package/src/common.js
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
export const restaurantId = parseInt(process.env.VUE_APP_RESTAURANT_ID) || null;
|
|
2
|
+
|
|
3
|
+
export function commonErrorCallback(unknownErrorMessage = 'Something went wrong'){
|
|
4
|
+
return error => {
|
|
5
|
+
const status = error.response ? error.response.status : null;
|
|
6
|
+
if (status === 422) {
|
|
7
|
+
return {
|
|
8
|
+
type: 'error',
|
|
9
|
+
msg: Object.values(error.response.data.error.validation).map(m => m[0]).toString()
|
|
10
|
+
}
|
|
11
|
+
} else if ([401, 403, 404, 400].includes(status)) {
|
|
12
|
+
return {
|
|
13
|
+
type: 'error',
|
|
14
|
+
msg: error.response.data.message.body
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
return {
|
|
18
|
+
type: 'error',
|
|
19
|
+
msg: unknownErrorMessage
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export function calculateBasketIdParameter(isLogin) {
|
|
25
|
+
if(isLogin) return undefined;
|
|
26
|
+
// localStorage might fail
|
|
27
|
+
let baskets = [];
|
|
28
|
+
try{
|
|
29
|
+
baskets = JSON.parse(localStorage.getItem("basket")) || [];
|
|
30
|
+
}catch(e){
|
|
31
|
+
console.error(e);
|
|
32
|
+
throw new Error('Basket not found');
|
|
33
|
+
}
|
|
34
|
+
const foundBasket = baskets.find(basket => Number(basket.restaurantId) === restaurantId);
|
|
35
|
+
if(!foundBasket){
|
|
36
|
+
throw new Error('Basket not found');
|
|
37
|
+
}
|
|
38
|
+
return foundBasket.basketId;
|
|
39
|
+
}
|
package/src/modules/auth.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import axios from "axios";
|
|
2
|
+
import { commonErrorCallback, calculateBasketIdParameter, restaurantId } from '../common';
|
|
2
3
|
|
|
3
4
|
const state = {
|
|
4
5
|
publicToken: null,
|
|
@@ -63,26 +64,9 @@ const actions = {
|
|
|
63
64
|
commit('setPublicToken', res.data.data.access_token)
|
|
64
65
|
window.localStorage.setItem("publicToken", res.data.data.access_token);
|
|
65
66
|
})
|
|
66
|
-
.catch(
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
return {
|
|
70
|
-
type: 'error',
|
|
71
|
-
msg: Object.values(error.response.data.error.validation).map(m => { return m[0] }).toString()
|
|
72
|
-
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
if (error.response.status == 401 || error.response.status == 403 || error.response.status == 404 || error.response.status == 400) {
|
|
76
|
-
|
|
77
|
-
return {
|
|
78
|
-
type: 'error',
|
|
79
|
-
msg: error.response.data.message.body
|
|
80
|
-
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
}
|
|
85
|
-
});
|
|
67
|
+
.catch(
|
|
68
|
+
commonErrorCallback()
|
|
69
|
+
);
|
|
86
70
|
},
|
|
87
71
|
login({ commit, dispatch }, authData) {
|
|
88
72
|
var data = { ...authData };
|
|
@@ -126,27 +110,9 @@ const actions = {
|
|
|
126
110
|
msg: 'ok'
|
|
127
111
|
}
|
|
128
112
|
})
|
|
129
|
-
.catch(
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
return {
|
|
133
|
-
type: 'error',
|
|
134
|
-
msg: Object.values(error.response.data.error.validation).map(m => { return m[0] }).toString()
|
|
135
|
-
|
|
136
|
-
}
|
|
137
|
-
}
|
|
138
|
-
if (error.response.status == 401 || error.response.status == 403 || error.response.status == 404 || error.response.status == 400) {
|
|
139
|
-
|
|
140
|
-
return {
|
|
141
|
-
type: 'error',
|
|
142
|
-
msg: error.response.data.message.body
|
|
143
|
-
|
|
144
|
-
}
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
}
|
|
148
|
-
console.clear()
|
|
149
|
-
});
|
|
113
|
+
.catch(
|
|
114
|
+
commonErrorCallback()
|
|
115
|
+
);
|
|
150
116
|
},
|
|
151
117
|
signup({ dispatch }, authData) {
|
|
152
118
|
var data = { ...authData };
|
|
@@ -174,26 +140,9 @@ const actions = {
|
|
|
174
140
|
msg: res.data.message.body
|
|
175
141
|
}
|
|
176
142
|
})
|
|
177
|
-
.catch(
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
return {
|
|
181
|
-
type: 'error',
|
|
182
|
-
msg: Object.values(error.response.data.error.validation).map(m => { return m[0] }).toString()
|
|
183
|
-
|
|
184
|
-
}
|
|
185
|
-
}
|
|
186
|
-
if (error.response.status == 401 || error.response.status == 403 || error.response.status == 404 || error.response.status == 400) {
|
|
187
|
-
|
|
188
|
-
return {
|
|
189
|
-
type: 'error',
|
|
190
|
-
msg: error.response.data.message.body
|
|
191
|
-
|
|
192
|
-
}
|
|
193
|
-
}
|
|
194
|
-
|
|
195
|
-
}
|
|
196
|
-
});
|
|
143
|
+
.catch(
|
|
144
|
+
commonErrorCallback()
|
|
145
|
+
);
|
|
197
146
|
},
|
|
198
147
|
tryAutoLogin({ commit, dispatch }) {
|
|
199
148
|
const privateToken = window.localStorage.getItem("privateToken")
|
|
@@ -231,26 +180,9 @@ const actions = {
|
|
|
231
180
|
// commit("product/SetSubtotalPrice", null, { root: true });
|
|
232
181
|
return true
|
|
233
182
|
})
|
|
234
|
-
.catch(
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
return {
|
|
238
|
-
type: 'error',
|
|
239
|
-
msg: Object.values(error.response.data.error.validation).map(m => { return m[0] }).toString()
|
|
240
|
-
|
|
241
|
-
}
|
|
242
|
-
}
|
|
243
|
-
if (error.response.status == 401 || error.response.status == 403 || error.response.status == 404 || error.response.status == 400) {
|
|
244
|
-
|
|
245
|
-
return {
|
|
246
|
-
type: 'error',
|
|
247
|
-
msg: error.response.data.message.body
|
|
248
|
-
|
|
249
|
-
}
|
|
250
|
-
}
|
|
251
|
-
|
|
252
|
-
}
|
|
253
|
-
});
|
|
183
|
+
.catch(
|
|
184
|
+
commonErrorCallback()
|
|
185
|
+
);
|
|
254
186
|
},
|
|
255
187
|
fetchUser({ commit, state }) {
|
|
256
188
|
|
|
@@ -264,26 +196,9 @@ const actions = {
|
|
|
264
196
|
user.postalCode = user.postal_code
|
|
265
197
|
commit("storeUser", user);
|
|
266
198
|
})
|
|
267
|
-
.catch(
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
return {
|
|
271
|
-
type: 'error',
|
|
272
|
-
msg: Object.values(error.response.data.error.validation).map(m => { return m[0] }).toString()
|
|
273
|
-
|
|
274
|
-
}
|
|
275
|
-
}
|
|
276
|
-
if (error.response.status == 401 || error.response.status == 403 || error.response.status == 404 || error.response.status == 400) {
|
|
277
|
-
|
|
278
|
-
return {
|
|
279
|
-
type: 'error',
|
|
280
|
-
msg: error.response.data.message.body
|
|
281
|
-
|
|
282
|
-
}
|
|
283
|
-
}
|
|
284
|
-
|
|
285
|
-
}
|
|
286
|
-
});
|
|
199
|
+
.catch(
|
|
200
|
+
commonErrorCallback()
|
|
201
|
+
);
|
|
287
202
|
},
|
|
288
203
|
assignBasket({ dispatch }, restaurantId) {
|
|
289
204
|
const basket = JSON.parse(localStorage.getItem("basket"));
|
|
@@ -296,26 +211,9 @@ const actions = {
|
|
|
296
211
|
.then(() => {
|
|
297
212
|
dispatch('product/getBasket', restaurantId, { root: true })
|
|
298
213
|
})
|
|
299
|
-
.catch(
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
return {
|
|
303
|
-
type: 'error',
|
|
304
|
-
msg: Object.values(error.response.data.error.validation).map(m => { return m[0] }).toString()
|
|
305
|
-
|
|
306
|
-
}
|
|
307
|
-
}
|
|
308
|
-
if (error.response.status == 401 || error.response.status == 403 || error.response.status == 404 || error.response.status == 400) {
|
|
309
|
-
|
|
310
|
-
return {
|
|
311
|
-
type: 'error',
|
|
312
|
-
msg: error.response.data.message.body
|
|
313
|
-
|
|
314
|
-
}
|
|
315
|
-
}
|
|
316
|
-
|
|
317
|
-
}
|
|
318
|
-
});
|
|
214
|
+
.catch(
|
|
215
|
+
commonErrorCallback()
|
|
216
|
+
);
|
|
319
217
|
},
|
|
320
218
|
unassignBasket({ }, restaurantId) {
|
|
321
219
|
if (restaurantId) {
|
|
@@ -332,23 +230,9 @@ const actions = {
|
|
|
332
230
|
msg: 'ok'
|
|
333
231
|
};
|
|
334
232
|
})
|
|
335
|
-
.catch(
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
return {
|
|
339
|
-
type: 'error',
|
|
340
|
-
msg: Object.values(error.response.data.error.validation).map(m => { return m[0] }).toString()
|
|
341
|
-
}
|
|
342
|
-
}
|
|
343
|
-
if (error.response.status == 401 || error.response.status == 403 || error.response.status == 404 || error.response.status == 400) {
|
|
344
|
-
return {
|
|
345
|
-
type: 'error',
|
|
346
|
-
msg: error.response.data.message.body
|
|
347
|
-
}
|
|
348
|
-
}
|
|
349
|
-
|
|
350
|
-
}
|
|
351
|
-
});
|
|
233
|
+
.catch(
|
|
234
|
+
commonErrorCallback()
|
|
235
|
+
);
|
|
352
236
|
}
|
|
353
237
|
else {
|
|
354
238
|
let basket = JSON.parse(localStorage.getItem("basket"));
|
|
@@ -363,23 +247,9 @@ const actions = {
|
|
|
363
247
|
msg: 'ok'
|
|
364
248
|
};
|
|
365
249
|
})
|
|
366
|
-
.catch(
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
return {
|
|
370
|
-
type: 'error',
|
|
371
|
-
msg: Object.values(error.response.data.error.validation).map(m => { return m[0] }).toString()
|
|
372
|
-
}
|
|
373
|
-
}
|
|
374
|
-
if (error.response.status == 401 || error.response.status == 403 || error.response.status == 404 || error.response.status == 400) {
|
|
375
|
-
return {
|
|
376
|
-
type: 'error',
|
|
377
|
-
msg: error.response.data.message.body
|
|
378
|
-
}
|
|
379
|
-
}
|
|
380
|
-
|
|
381
|
-
}
|
|
382
|
-
});
|
|
250
|
+
.catch(
|
|
251
|
+
commonErrorCallback()
|
|
252
|
+
);
|
|
383
253
|
}
|
|
384
254
|
}
|
|
385
255
|
},
|
|
@@ -393,26 +263,9 @@ const actions = {
|
|
|
393
263
|
.then(res => {
|
|
394
264
|
commit('setrestaurantInfo', res.data.data)
|
|
395
265
|
})
|
|
396
|
-
.catch(
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
return {
|
|
400
|
-
type: 'error',
|
|
401
|
-
msg: Object.values(error.response.data.error.validation).map(m => { return m[0] }).toString()
|
|
402
|
-
|
|
403
|
-
}
|
|
404
|
-
}
|
|
405
|
-
if (error.response.status == 401 || error.response.status == 403 || error.response.status == 404 || error.response.status == 400) {
|
|
406
|
-
|
|
407
|
-
return {
|
|
408
|
-
type: 'error',
|
|
409
|
-
msg: error.response.data.message.body
|
|
410
|
-
|
|
411
|
-
}
|
|
412
|
-
}
|
|
413
|
-
|
|
414
|
-
}
|
|
415
|
-
});
|
|
266
|
+
.catch(
|
|
267
|
+
commonErrorCallback()
|
|
268
|
+
);
|
|
416
269
|
},
|
|
417
270
|
userUpdate({ dispatch }, userData) {
|
|
418
271
|
return axios
|
|
@@ -425,26 +278,9 @@ const actions = {
|
|
|
425
278
|
.then(() => {
|
|
426
279
|
dispatch('fetchUser')
|
|
427
280
|
})
|
|
428
|
-
.catch(
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
return {
|
|
432
|
-
type: 'error',
|
|
433
|
-
msg: Object.values(error.response.data.error.validation).map(m => { return m[0] }).toString()
|
|
434
|
-
|
|
435
|
-
}
|
|
436
|
-
}
|
|
437
|
-
if (error.response.status == 401 || error.response.status == 403 || error.response.status == 404 || error.response.status == 400) {
|
|
438
|
-
|
|
439
|
-
return {
|
|
440
|
-
type: 'error',
|
|
441
|
-
msg: error.response.data.message.body
|
|
442
|
-
|
|
443
|
-
}
|
|
444
|
-
}
|
|
445
|
-
|
|
446
|
-
}
|
|
447
|
-
});
|
|
281
|
+
.catch(
|
|
282
|
+
commonErrorCallback()
|
|
283
|
+
);
|
|
448
284
|
},
|
|
449
285
|
forgotPassword({ dispatch }, data) {
|
|
450
286
|
const formData = typeof data == 'object' ? {
|
|
@@ -460,26 +296,9 @@ const actions = {
|
|
|
460
296
|
msg: res.data.message.body
|
|
461
297
|
}
|
|
462
298
|
})
|
|
463
|
-
.catch(
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
return {
|
|
467
|
-
type: 'error',
|
|
468
|
-
msg: Object.values(error.response.data.error.validation).map(m => { return m[0] }).toString()
|
|
469
|
-
|
|
470
|
-
}
|
|
471
|
-
}
|
|
472
|
-
if (error.response.status == 401 || error.response.status == 403 || error.response.status == 404 || error.response.status == 400) {
|
|
473
|
-
|
|
474
|
-
return {
|
|
475
|
-
type: 'error',
|
|
476
|
-
msg: error.response.data.message.body
|
|
477
|
-
|
|
478
|
-
}
|
|
479
|
-
}
|
|
480
|
-
|
|
481
|
-
}
|
|
482
|
-
});
|
|
299
|
+
.catch(
|
|
300
|
+
commonErrorCallback()
|
|
301
|
+
);
|
|
483
302
|
},
|
|
484
303
|
checkToken({ commit }, token) {
|
|
485
304
|
return axios
|
|
@@ -491,26 +310,9 @@ const actions = {
|
|
|
491
310
|
msg: 'ok'
|
|
492
311
|
}
|
|
493
312
|
})
|
|
494
|
-
.catch(
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
return {
|
|
498
|
-
type: 'error',
|
|
499
|
-
msg: Object.values(error.response.data.error.validation).map(m => { return m[0] }).toString()
|
|
500
|
-
|
|
501
|
-
}
|
|
502
|
-
}
|
|
503
|
-
if (error.response.status == 401 || error.response.status == 403 || error.response.status == 404 || error.response.status == 400) {
|
|
504
|
-
|
|
505
|
-
return {
|
|
506
|
-
type: 'error',
|
|
507
|
-
msg: error.response.data.message.body
|
|
508
|
-
|
|
509
|
-
}
|
|
510
|
-
}
|
|
511
|
-
|
|
512
|
-
}
|
|
513
|
-
});
|
|
313
|
+
.catch(
|
|
314
|
+
commonErrorCallback()
|
|
315
|
+
);
|
|
514
316
|
},
|
|
515
317
|
resetPassword({ }, data) {
|
|
516
318
|
return axios
|
|
@@ -528,26 +330,9 @@ const actions = {
|
|
|
528
330
|
}
|
|
529
331
|
|
|
530
332
|
})
|
|
531
|
-
.catch(
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
return {
|
|
535
|
-
type: 'error',
|
|
536
|
-
msg: Object.values(error.response.data.error.validation).map(m => { return m[0] }).toString()
|
|
537
|
-
|
|
538
|
-
}
|
|
539
|
-
}
|
|
540
|
-
if (error.response.status == 401 || error.response.status == 403 || error.response.status == 404 || error.response.status == 400) {
|
|
541
|
-
|
|
542
|
-
return {
|
|
543
|
-
type: 'error',
|
|
544
|
-
msg: error.response.data.message.body
|
|
545
|
-
|
|
546
|
-
}
|
|
547
|
-
}
|
|
548
|
-
|
|
549
|
-
}
|
|
550
|
-
});
|
|
333
|
+
.catch(
|
|
334
|
+
commonErrorCallback()
|
|
335
|
+
);
|
|
551
336
|
|
|
552
337
|
},
|
|
553
338
|
update({ commit }, userData) {
|
|
@@ -562,24 +347,9 @@ const actions = {
|
|
|
562
347
|
type: 'success',
|
|
563
348
|
msg: result.data.message.body
|
|
564
349
|
}
|
|
565
|
-
}).catch(
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
if (status === 422) {
|
|
569
|
-
return {
|
|
570
|
-
type: 'error',
|
|
571
|
-
msg: Object.values(error.response.data.error.validation).map(m => { return m[0] }).toString()
|
|
572
|
-
}
|
|
573
|
-
}
|
|
574
|
-
if ([401, 403, 404, 400].includes(status)) {
|
|
575
|
-
return {
|
|
576
|
-
type: 'error',
|
|
577
|
-
msg: error.response.data.message.body
|
|
578
|
-
}
|
|
579
|
-
}
|
|
580
|
-
|
|
581
|
-
}
|
|
582
|
-
});
|
|
350
|
+
}).catch(
|
|
351
|
+
commonErrorCallback()
|
|
352
|
+
);
|
|
583
353
|
},
|
|
584
354
|
getUserAddress({ commit }) {
|
|
585
355
|
return axios.get('api/auth/user/address').then((res) => {
|
|
@@ -588,26 +358,9 @@ const actions = {
|
|
|
588
358
|
type: 'success',
|
|
589
359
|
msg: 'ok'
|
|
590
360
|
}
|
|
591
|
-
}).catch(
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
return {
|
|
595
|
-
type: 'error',
|
|
596
|
-
msg: Object.values(error.response.data.error.validation).map(m => { return m[0] }).toString()
|
|
597
|
-
|
|
598
|
-
}
|
|
599
|
-
}
|
|
600
|
-
if (error.response.status == 401 || error.response.status == 403 || error.response.status == 404 || error.response.status == 400) {
|
|
601
|
-
|
|
602
|
-
return {
|
|
603
|
-
type: 'error',
|
|
604
|
-
msg: error.response.data.message.body
|
|
605
|
-
|
|
606
|
-
}
|
|
607
|
-
}
|
|
608
|
-
|
|
609
|
-
}
|
|
610
|
-
});
|
|
361
|
+
}).catch(
|
|
362
|
+
commonErrorCallback()
|
|
363
|
+
);
|
|
611
364
|
},
|
|
612
365
|
addUserAddress({ dispatch }, data) {
|
|
613
366
|
return axios.post('api/auth/user/address/add', null, { params: data }).then((res) => {
|
|
@@ -616,25 +369,9 @@ const actions = {
|
|
|
616
369
|
type: 'success',
|
|
617
370
|
msg: res.data.message.body
|
|
618
371
|
}
|
|
619
|
-
}).catch(
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
return {
|
|
623
|
-
type: 'error',
|
|
624
|
-
msg: Object.values(error.response.data.error.validation).map(m => { return m[0] }).toString()
|
|
625
|
-
}
|
|
626
|
-
}
|
|
627
|
-
if (error.response.status == 401 || error.response.status == 403 || error.response.status == 404 || error.response.status == 400) {
|
|
628
|
-
|
|
629
|
-
return {
|
|
630
|
-
type: 'error',
|
|
631
|
-
msg: error.response.data.message.body
|
|
632
|
-
|
|
633
|
-
}
|
|
634
|
-
}
|
|
635
|
-
|
|
636
|
-
}
|
|
637
|
-
});
|
|
372
|
+
}).catch(
|
|
373
|
+
commonErrorCallback()
|
|
374
|
+
);
|
|
638
375
|
},
|
|
639
376
|
removeUserAddress({ dispatch }, id) {
|
|
640
377
|
return axios.put('api/auth/user/address/remove', null, { params: { id } }).then((res) => {
|
|
@@ -643,25 +380,9 @@ const actions = {
|
|
|
643
380
|
type: 'success',
|
|
644
381
|
msg: res.data.message.body
|
|
645
382
|
}
|
|
646
|
-
}).catch(
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
return {
|
|
650
|
-
type: 'error',
|
|
651
|
-
msg: Object.values(error.response.data.error.validation).map(m => { return m[0] }).toString()
|
|
652
|
-
}
|
|
653
|
-
}
|
|
654
|
-
if (error.response.status == 401 || error.response.status == 403 || error.response.status == 404 || error.response.status == 400) {
|
|
655
|
-
|
|
656
|
-
return {
|
|
657
|
-
type: 'error',
|
|
658
|
-
msg: error.response.data.message.body
|
|
659
|
-
|
|
660
|
-
}
|
|
661
|
-
}
|
|
662
|
-
|
|
663
|
-
}
|
|
664
|
-
});
|
|
383
|
+
}).catch(
|
|
384
|
+
commonErrorCallback()
|
|
385
|
+
);
|
|
665
386
|
},
|
|
666
387
|
editUserAddress({ dispatch }, data) {
|
|
667
388
|
return axios.post('api/auth/user/address/edit', null, { params: data }).then((res) => {
|
|
@@ -670,25 +391,9 @@ const actions = {
|
|
|
670
391
|
type: 'success',
|
|
671
392
|
msg: res.data.message.body
|
|
672
393
|
}
|
|
673
|
-
}).catch(
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
return {
|
|
677
|
-
type: 'error',
|
|
678
|
-
msg: Object.values(error.response.data.error.validation).map(m => { return m[0] }).toString()
|
|
679
|
-
}
|
|
680
|
-
}
|
|
681
|
-
if (error.response.status == 401 || error.response.status == 403 || error.response.status == 404 || error.response.status == 400) {
|
|
682
|
-
|
|
683
|
-
return {
|
|
684
|
-
type: 'error',
|
|
685
|
-
msg: error.response.data.message.body
|
|
686
|
-
|
|
687
|
-
}
|
|
688
|
-
}
|
|
689
|
-
|
|
690
|
-
}
|
|
691
|
-
});
|
|
394
|
+
}).catch(
|
|
395
|
+
commonErrorCallback()
|
|
396
|
+
);
|
|
692
397
|
}
|
|
693
398
|
};
|
|
694
399
|
|