@@ -294,6 +294,7 @@ const mainStore = {
294
294
throw new Error ( resp ?. message ?. join ( ',' ) || resp ?. message ) ;
295
295
} else if ( 'statusCode' in resp && resp . statusCode !== 200 && resp . statusCode !== 201 ) {
296
296
throw new Error ( resp . message )
297
+
297
298
}
298
299
299
300
dispatch ( 'getPeopleMembers' )
@@ -306,6 +307,7 @@ const mainStore = {
306
307
const url = `${ apiServerBaseUrl } /people/invite/accept/${ payload } ` ;
307
308
const resp = await RequestHandler ( url , 'POST' , { } , UtilsMixin . methods . getHeader ( getters . getAuthToken ) )
308
309
310
+
309
311
if ( ! resp || Array . isArray ( resp . message ) ) {
310
312
throw new Error ( resp ?. message ?. join ( ',' ) || resp ?. message ) ;
311
313
} else if ( 'statusCode' in resp && resp . statusCode !== 200 && resp . statusCode !== 201 ) {
@@ -323,13 +325,15 @@ const mainStore = {
323
325
'DELETE' ,
324
326
{
325
327
emailId : payload
328
+
326
329
} ,
327
330
UtilsMixin . methods . getHeader ( getters . getAuthToken ) ,
328
331
)
329
332
if ( ! resp || Array . isArray ( resp . message ) ) {
330
333
throw new Error ( resp ?. message ?. join ( ',' ) || resp ?. message ) ;
331
334
} else if ( 'statusCode' in resp && resp . statusCode !== 200 && resp . statusCode !== 201 ) {
332
335
throw new Error ( resp . message )
336
+
333
337
}
334
338
await dispatch ( 'getPeopleMembers' ) ;
335
339
return resp ;
@@ -338,12 +342,14 @@ const mainStore = {
338
342
339
343
getPeopleMembers : async ( { getters, commit } ) => {
340
344
const url = `${ apiServerBaseUrl } /people` ;
345
+
341
346
const response = await RequestHandler ( url , 'GET' , { } ,
342
347
UtilsMixin . methods . getHeader ( getters . getAuthToken )
343
348
)
344
349
if ( Array . isArray ( response ) ) {
345
350
commit ( 'setAdminMembers' , response )
346
351
return response ;
352
+
347
353
}
348
354
const message = Array . isArray ( response ?. message )
349
355
? response . message . join ( ', ' )
@@ -355,10 +361,12 @@ const mainStore = {
355
361
356
362
getInvitions : async ( { getters, commit } ) => {
357
363
const url = `${ apiServerBaseUrl } /people/invites` ;
364
+
358
365
const resp = await RequestHandler ( url , 'GET' , { } , UtilsMixin . methods . getHeader ( getters . getAuthToken ) )
359
366
if ( Array . isArray ( resp ) ) {
360
367
commit ( 'setMyInvitions' , resp )
361
368
return resp ;
369
+
362
370
}
363
371
364
372
const message = Array . isArray ( resp ?. message )
@@ -373,6 +381,7 @@ const mainStore = {
373
381
attachMemberToARole : async ( { getters, dispatch } , payload ) => {
374
382
375
383
const url = `${ apiServerBaseUrl } /people/roles/attach` ;
384
+
376
385
const resp = await RequestHandler ( url ,
377
386
'POST' ,
378
387
payload ,
@@ -384,6 +393,7 @@ const mainStore = {
384
393
throw new Error ( resp ?. message ?. join ( ',' ) || resp ?. message ) ;
385
394
} else if ( 'statusCode' in resp && resp ?. statusCode !== 200 && resp ?. statusCode !== 201 ) {
386
395
throw new Error ( resp . message )
396
+
387
397
}
388
398
389
399
dispatch ( 'getPeopleMembers' )
@@ -393,6 +403,7 @@ const mainStore = {
393
403
switchToAdmin : async ( { getters } , payload ) => {
394
404
395
405
const url = `${ apiServerBaseUrl } /people/admin/login` ;
406
+
396
407
const resp = await RequestHandler ( url ,
397
408
'POST' ,
398
409
payload ,
@@ -402,6 +413,7 @@ const mainStore = {
402
413
throw new Error ( resp ?. message ?. join ( ',' ) || resp ?. message ) ;
403
414
} else if ( 'statusCode' in resp && ( resp . statusCode !== 200 || 201 ) ) {
404
415
throw new Error ( resp . message )
416
+
405
417
}
406
418
return resp ;
407
419
} ,
@@ -410,6 +422,7 @@ const mainStore = {
410
422
411
423
getMyRolesAction : async ( { getters, commit } ) => {
412
424
const url = `${ apiServerBaseUrl } /roles` ;
425
+
413
426
const resp = await RequestHandler ( url ,
414
427
'GET' ,
415
428
{ } ,
@@ -418,6 +431,7 @@ const mainStore = {
418
431
if ( Array . isArray ( resp ) ) {
419
432
commit ( 'setAllRoles' , resp )
420
433
return resp ;
434
+
421
435
}
422
436
const message = Array . isArray ( resp ?. message )
423
437
? resp . message . join ( ', ' )
@@ -431,6 +445,7 @@ const mainStore = {
431
445
createARole : async ( { getters, dispatch } , payload ) => {
432
446
433
447
const url = `${ apiServerBaseUrl } /roles` ;
448
+ ]
434
449
const resp = await RequestHandler ( url ,
435
450
'POST' ,
436
451
payload ,
@@ -441,6 +456,7 @@ const mainStore = {
441
456
throw new Error ( resp ?. message ?. join ( ',' ) || resp ?. message ) ;
442
457
} else if ( 'statusCode' in resp && resp . statusCode !== 200 && resp . statusCode !== 201 ) {
443
458
throw new Error ( resp . message )
459
+
444
460
}
445
461
446
462
dispatch ( 'getMyRolesAction' )
@@ -459,6 +475,7 @@ const mainStore = {
459
475
throw new Error ( resp ?. message ?. join ( ',' ) || resp ?. message ) ;
460
476
} else if ( 'statusCode' in resp && resp . statusCode !== 200 && resp . statusCode !== 201 ) {
461
477
throw new Error ( resp . message )
478
+ ]
462
479
}
463
480
464
481
dispatch ( 'getMyRolesAction' )
@@ -468,11 +485,13 @@ const mainStore = {
468
485
469
486
updateARole : async ( { getters, dispatch } , payload ) => {
470
487
const url = `${ apiServerBaseUrl } /roles/${ payload . _id } ` ;
488
+ ]
471
489
const resp = await RequestHandler ( url , 'PATCH' , payload , UtilsMixin . methods . getHeader ( getters . getAuthToken ) )
472
490
if ( ! resp && Array . isArray ( resp . message ) ) {
473
491
throw new Error ( resp ?. message ?. join ( ',' ) || resp ?. message ) ;
474
492
} else if ( 'statusCode' in resp && resp ?. statusCode !== 200 && resp ?. statusCode !== 201 ) {
475
493
throw new Error ( resp . message )
494
+
476
495
}
477
496
dispatch ( 'getMyRolesAction' )
478
497
return resp ;
@@ -539,6 +558,7 @@ const mainStore = {
539
558
540
559
if ( ! twoFactorAuthenticationCode ) throw new Error ( 'MFA PIN must be provided' )
541
560
const url = `${ apiServerBaseUrl } /auth/mfa/verify` ;
561
+
542
562
const resp = await RequestHandler ( url , 'POST' , {
543
563
authenticatorType,
544
564
twoFactorAuthenticationCode
@@ -548,6 +568,7 @@ const mainStore = {
548
568
549
569
if ( ! resp || Array . isArray ( resp . message ) ) {
550
570
throw new Error ( resp . message . join ( ',' ) ) ;
571
+
551
572
}
552
573
553
574
return resp ;
@@ -564,7 +585,8 @@ const mainStore = {
564
585
fetch ( url , {
565
586
method : 'POST' ,
566
587
headers,
567
- body : JSON . stringify ( payload )
588
+ body : JSON . stringify ( payload ) ,
589
+ credentials : 'include' ,
568
590
} )
569
591
. then ( response => response . json ( ) )
570
592
. then ( json => {
@@ -604,7 +626,8 @@ const mainStore = {
604
626
fetch ( url , {
605
627
method : 'PUT' ,
606
628
headers,
607
- body : JSON . stringify ( payload )
629
+ body : JSON . stringify ( payload ) ,
630
+ credentials : 'include' ,
608
631
} ) . then ( response => {
609
632
return response . json ( )
610
633
} ) . then ( json => {
@@ -634,6 +657,7 @@ const mainStore = {
634
657
fetch ( url , {
635
658
method : 'DELETE' ,
636
659
headers,
660
+ credentials : 'include' ,
637
661
} ) . then ( response => response . json ( ) ) . then ( json => {
638
662
if ( json . error ) {
639
663
return reject ( new Error ( json . message . join ( ' ' ) ) )
@@ -694,6 +718,7 @@ const mainStore = {
694
718
throw new Error ( `Could not fetch accesstoken for service ${ serviceId } ` )
695
719
}
696
720
721
+
697
722
} catch ( e ) {
698
723
throw new Error ( `Error while updating an app: ${ e . message } ` ) ;
699
724
}
@@ -728,6 +753,7 @@ const mainStore = {
728
753
fetch ( url , {
729
754
method : 'POST' ,
730
755
headers,
756
+ credentials : 'include' ,
731
757
} )
732
758
. then ( response => response . json ( ) )
733
759
. then ( json => {
@@ -792,7 +818,7 @@ const mainStore = {
792
818
headers
793
819
} ) . then ( response => response . json ( ) ) . then ( json => {
794
820
if ( json . error ) {
795
- return reject ( new Error ( json . error . join ( ' ' ) ) )
821
+ return reject ( new Error ( json . error ?. details . join ( ' ' ) || json . error . join ( ' ' ) ) )
796
822
}
797
823
commit ( 'insertSessions' , json . data . sessionDetails ) ;
798
824
resolve ( )
@@ -843,7 +869,7 @@ const mainStore = {
843
869
body : JSON . stringify ( payload ) ,
844
870
} ) . then ( response => response . json ( ) ) . then ( json => {
845
871
if ( json . error ) {
846
- return reject ( new Error ( json . error . join ( ' ' ) ) )
872
+ return reject ( new Error ( json . error ?. details . join ( ' ' ) || json . error . join ( ' ' ) ) )
847
873
}
848
874
commit ( 'setOnChainConfig' , json . data ) ;
849
875
resolve ( json . data )
@@ -868,7 +894,7 @@ const mainStore = {
868
894
body : JSON . stringify ( payload ) ,
869
895
} ) . then ( response => response . json ( ) ) . then ( json => {
870
896
if ( json . error ) {
871
- return reject ( new Error ( json . error . join ( ' ' ) ) )
897
+ return reject ( new Error ( json . error ?. details . join ( ' ' ) || json . error . join ( ' ' ) ) )
872
898
}
873
899
// restting
874
900
commit ( 'setOnChainConfig' , { } ) ;
@@ -893,7 +919,7 @@ const mainStore = {
893
919
headers,
894
920
} ) . then ( response => response . json ( ) ) . then ( json => {
895
921
if ( json . error ) {
896
- return reject ( new Error ( json . error . details . join ( ' ' ) ) )
922
+ return reject ( new Error ( json . error ? .details . join ( ' ' ) || json . error . join ( ' ' ) ) )
897
923
}
898
924
dispatch ( 'fetchAppsOnChainConfigs' )
899
925
resolve ( json )
@@ -923,7 +949,7 @@ const mainStore = {
923
949
body : JSON . stringify ( data ) ,
924
950
} ) . then ( response => response . json ( ) ) . then ( json => {
925
951
if ( json . error ) {
926
- return reject ( new Error ( json . error . join ( ' ' ) ) )
952
+ return reject ( new Error ( json . error ?. details . join ( ' ' ) || json . error . join ( ' ' ) ) )
927
953
}
928
954
commit ( 'setWidgetConfig' , json . data ) ;
929
955
resolve ( json . data )
@@ -948,7 +974,7 @@ const mainStore = {
948
974
} ) . then ( response => response . json ( ) ) . then ( json => {
949
975
if ( json ) {
950
976
if ( json . error ) {
951
- return reject ( new Error ( json . error . join ( ' ' ) ) )
977
+ return reject ( new Error ( json . error ?. details . join ( ' ' ) || json . error . join ( ' ' ) ) )
952
978
} else {
953
979
commit ( 'setWidgetConfig' , json . data ) ;
954
980
return resolve ( )
@@ -980,7 +1006,7 @@ const mainStore = {
980
1006
body : JSON . stringify ( data ) ,
981
1007
} ) . then ( response => response . json ( ) ) . then ( json => {
982
1008
if ( json . error ) {
983
- return reject ( new Error ( json . error . join ( ' ' ) ) )
1009
+ return reject ( new Error ( json . error ?. details . join ( ' ' ) || json . error . join ( ' ' ) ) )
984
1010
}
985
1011
// restting
986
1012
commit ( 'setWidgetConfig' , json . data ) ;
@@ -1145,7 +1171,7 @@ const mainStore = {
1145
1171
headers
1146
1172
} ) . then ( response => response . json ( ) ) . then ( json => {
1147
1173
if ( json . error ) {
1148
- return reject ( new Error ( json . error . join ( ' ' ) ) )
1174
+ return reject ( new Error ( json . error ?. details . join ( ' ' ) || json . error . join ( ' ' ) ) )
1149
1175
}
1150
1176
1151
1177
if ( json . data && Object . keys ( json . data ) ?. length > 0 ) {
0 commit comments