@iankibetsh/shframework 5.4.3 → 5.4.4
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/dist/library.js +68 -61
- package/dist/library.mjs +68 -61
- package/package.json +1 -1
package/dist/library.js
CHANGED
|
@@ -431,27 +431,26 @@ const updateSession = () =>{
|
|
|
431
431
|
};
|
|
432
432
|
|
|
433
433
|
const graphQlEndpoint = 'sh-ql';
|
|
434
|
-
let apiUrl = undefined.VITE_APP_API_URL;
|
|
435
434
|
// eslint-disable-next-line no-undef
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
435
|
+
let axios;
|
|
436
|
+
|
|
437
|
+
|
|
438
|
+
function initApi(baseApiUrl) {
|
|
439
|
+
axios = Axios__default["default"].create({
|
|
440
|
+
baseURL: baseApiUrl ?? undefined.VITE_APP_API_URL,
|
|
441
|
+
});
|
|
442
|
+
window.shAxionInstance = axios;
|
|
441
443
|
}
|
|
442
444
|
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
window.shAxionInstance = axios;
|
|
447
|
-
function doGet (endPoint, data,extraConfig) {
|
|
448
|
-
updateSession();
|
|
445
|
+
|
|
446
|
+
function doGet(endPoint, data, extraConfig) {
|
|
447
|
+
updateSession();
|
|
449
448
|
let accessToken = shStorage.getItem('access_token');
|
|
450
|
-
if(accessToken === 'undefined' || accessToken === 'null'){
|
|
449
|
+
if (accessToken === 'undefined' || accessToken === 'null') {
|
|
451
450
|
accessToken = null;
|
|
452
451
|
}
|
|
453
452
|
let config = {};
|
|
454
|
-
if(accessToken){
|
|
453
|
+
if (accessToken) {
|
|
455
454
|
config = {
|
|
456
455
|
headers: {
|
|
457
456
|
Authorization: 'Bearer ' + accessToken
|
|
@@ -461,21 +460,22 @@ function doGet (endPoint, data,extraConfig) {
|
|
|
461
460
|
if (extraConfig) {
|
|
462
461
|
Object.assign(config, extraConfig);
|
|
463
462
|
}
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
463
|
+
return axios.get(endPoint, {
|
|
464
|
+
params: data,
|
|
465
|
+
crossOrigin: true,
|
|
466
|
+
...config
|
|
467
|
+
})
|
|
469
468
|
}
|
|
470
|
-
|
|
471
|
-
|
|
469
|
+
|
|
470
|
+
function doPost(endPoint, data, extraConfig) {
|
|
471
|
+
updateSession();
|
|
472
472
|
let accessToken = shStorage.getItem('access_token');
|
|
473
|
-
if(accessToken === 'undefined' || accessToken === 'null'){
|
|
473
|
+
if (accessToken === 'undefined' || accessToken === 'null') {
|
|
474
474
|
accessToken = null;
|
|
475
475
|
}
|
|
476
476
|
let config = {};
|
|
477
|
-
if(accessToken){
|
|
478
|
-
|
|
477
|
+
if (accessToken) {
|
|
478
|
+
config = {
|
|
479
479
|
headers: {
|
|
480
480
|
Authorization: 'Bearer ' + accessToken
|
|
481
481
|
}
|
|
@@ -484,79 +484,84 @@ function doPost (endPoint, data, extraConfig) {
|
|
|
484
484
|
if (extraConfig) {
|
|
485
485
|
Object.assign(config, extraConfig);
|
|
486
486
|
}
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
487
|
+
return axios.post(endPoint,
|
|
488
|
+
data,
|
|
489
|
+
config
|
|
490
|
+
)
|
|
491
491
|
}
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
492
|
+
|
|
493
|
+
function doDelete(endPoint, data, extraConfig) {
|
|
494
|
+
updateSession();
|
|
495
|
+
const config = {
|
|
496
|
+
headers: {
|
|
497
|
+
Authorization: 'Bearer ' + shStorage.getItem('access_token')
|
|
498
|
+
}
|
|
499
|
+
};
|
|
499
500
|
if (extraConfig) {
|
|
500
501
|
Object.assign(config, extraConfig);
|
|
501
502
|
}
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
503
|
+
return axios.delete(endPoint,
|
|
504
|
+
data,
|
|
505
|
+
config
|
|
506
|
+
)
|
|
506
507
|
}
|
|
507
|
-
|
|
508
|
+
|
|
509
|
+
function doPut(endPoint, data, extraConfig) {
|
|
508
510
|
updateSession();
|
|
509
511
|
const config = {
|
|
510
512
|
headers: {
|
|
511
|
-
|
|
513
|
+
Authorization: 'Bearer ' + shStorage.getItem('access_token')
|
|
512
514
|
}
|
|
513
515
|
};
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
516
|
+
if (extraConfig) {
|
|
517
|
+
Object.assign(config, extraConfig);
|
|
518
|
+
}
|
|
517
519
|
return axios.put(endPoint,
|
|
518
520
|
data,
|
|
519
521
|
config
|
|
520
522
|
)
|
|
521
523
|
|
|
522
524
|
}
|
|
523
|
-
|
|
525
|
+
|
|
526
|
+
function doPatch(endPoint, data, extraConfig) {
|
|
524
527
|
updateSession();
|
|
525
528
|
const config = {
|
|
526
529
|
headers: {
|
|
527
|
-
|
|
530
|
+
Authorization: 'Bearer ' + shStorage.getItem('access_token')
|
|
528
531
|
}
|
|
529
532
|
};
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
+
if (extraConfig) {
|
|
534
|
+
Object.assign(config, extraConfig);
|
|
535
|
+
}
|
|
533
536
|
return axios.patch(endPoint,
|
|
534
537
|
data,
|
|
535
538
|
config
|
|
536
539
|
)
|
|
537
540
|
|
|
538
541
|
}
|
|
542
|
+
|
|
539
543
|
function graphQlQuery(query) {
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
+
const data = {
|
|
545
|
+
query
|
|
546
|
+
};
|
|
547
|
+
return doGet(graphQlEndpoint, data)
|
|
544
548
|
}
|
|
549
|
+
|
|
545
550
|
function graphQlMutate(mutation) {
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
551
|
+
const data = {
|
|
552
|
+
query: `mutation ${mutation}`
|
|
553
|
+
};
|
|
554
|
+
return doPost(graphQlEndpoint, data)
|
|
550
555
|
}
|
|
551
556
|
|
|
552
557
|
var shApis = {
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
558
|
+
doGet,
|
|
559
|
+
doPost,
|
|
560
|
+
graphQlQuery,
|
|
556
561
|
doDelete,
|
|
557
562
|
doPut,
|
|
558
563
|
doPatch,
|
|
559
|
-
|
|
564
|
+
graphQlMutate
|
|
560
565
|
};
|
|
561
566
|
|
|
562
567
|
const countries = [
|
|
@@ -7555,6 +7560,7 @@ const ShFrontend = {
|
|
|
7555
7560
|
const noRecordsComponent = options.noRecordsComponent ?? script$k;
|
|
7556
7561
|
const registrationFields = options.registrationFields ?? ['name','email','phone','password','password_confirmation'];
|
|
7557
7562
|
const AuthComponent = options.authComponent ?? script;
|
|
7563
|
+
const baseApiUrl = options.baseApiUrl ?? undefined.VITE_APP_API_URL;
|
|
7558
7564
|
app.provide('loginEndpoint',loginEndpoint);
|
|
7559
7565
|
app.provide('registerEndpoint', registerEndpoint);
|
|
7560
7566
|
app.provide('registrationFields', registrationFields);
|
|
@@ -7570,6 +7576,7 @@ const ShFrontend = {
|
|
|
7570
7576
|
app.provide('noRecordsComponent',noRecordsComponent);
|
|
7571
7577
|
app.provide('forgotEndpoint',forgotEndpoint);
|
|
7572
7578
|
window.swalPosition = swalPosition;
|
|
7579
|
+
initApi(baseApiUrl);
|
|
7573
7580
|
if(options.router) {
|
|
7574
7581
|
options.router.addRoute({
|
|
7575
7582
|
path: '/sh-auth',
|
package/dist/library.mjs
CHANGED
|
@@ -419,27 +419,26 @@ const updateSession = () =>{
|
|
|
419
419
|
};
|
|
420
420
|
|
|
421
421
|
const graphQlEndpoint = 'sh-ql';
|
|
422
|
-
let apiUrl = import.meta.env.VITE_APP_API_URL;
|
|
423
422
|
// eslint-disable-next-line no-undef
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
423
|
+
let axios;
|
|
424
|
+
|
|
425
|
+
|
|
426
|
+
function initApi(baseApiUrl) {
|
|
427
|
+
axios = Axios.create({
|
|
428
|
+
baseURL: baseApiUrl ?? import.meta.env.VITE_APP_API_URL,
|
|
429
|
+
});
|
|
430
|
+
window.shAxionInstance = axios;
|
|
429
431
|
}
|
|
430
432
|
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
window.shAxionInstance = axios;
|
|
435
|
-
function doGet (endPoint, data,extraConfig) {
|
|
436
|
-
updateSession();
|
|
433
|
+
|
|
434
|
+
function doGet(endPoint, data, extraConfig) {
|
|
435
|
+
updateSession();
|
|
437
436
|
let accessToken = shStorage.getItem('access_token');
|
|
438
|
-
if(accessToken === 'undefined' || accessToken === 'null'){
|
|
437
|
+
if (accessToken === 'undefined' || accessToken === 'null') {
|
|
439
438
|
accessToken = null;
|
|
440
439
|
}
|
|
441
440
|
let config = {};
|
|
442
|
-
if(accessToken){
|
|
441
|
+
if (accessToken) {
|
|
443
442
|
config = {
|
|
444
443
|
headers: {
|
|
445
444
|
Authorization: 'Bearer ' + accessToken
|
|
@@ -449,21 +448,22 @@ function doGet (endPoint, data,extraConfig) {
|
|
|
449
448
|
if (extraConfig) {
|
|
450
449
|
Object.assign(config, extraConfig);
|
|
451
450
|
}
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
451
|
+
return axios.get(endPoint, {
|
|
452
|
+
params: data,
|
|
453
|
+
crossOrigin: true,
|
|
454
|
+
...config
|
|
455
|
+
})
|
|
457
456
|
}
|
|
458
|
-
|
|
459
|
-
|
|
457
|
+
|
|
458
|
+
function doPost(endPoint, data, extraConfig) {
|
|
459
|
+
updateSession();
|
|
460
460
|
let accessToken = shStorage.getItem('access_token');
|
|
461
|
-
if(accessToken === 'undefined' || accessToken === 'null'){
|
|
461
|
+
if (accessToken === 'undefined' || accessToken === 'null') {
|
|
462
462
|
accessToken = null;
|
|
463
463
|
}
|
|
464
464
|
let config = {};
|
|
465
|
-
if(accessToken){
|
|
466
|
-
|
|
465
|
+
if (accessToken) {
|
|
466
|
+
config = {
|
|
467
467
|
headers: {
|
|
468
468
|
Authorization: 'Bearer ' + accessToken
|
|
469
469
|
}
|
|
@@ -472,79 +472,84 @@ function doPost (endPoint, data, extraConfig) {
|
|
|
472
472
|
if (extraConfig) {
|
|
473
473
|
Object.assign(config, extraConfig);
|
|
474
474
|
}
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
475
|
+
return axios.post(endPoint,
|
|
476
|
+
data,
|
|
477
|
+
config
|
|
478
|
+
)
|
|
479
479
|
}
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
480
|
+
|
|
481
|
+
function doDelete(endPoint, data, extraConfig) {
|
|
482
|
+
updateSession();
|
|
483
|
+
const config = {
|
|
484
|
+
headers: {
|
|
485
|
+
Authorization: 'Bearer ' + shStorage.getItem('access_token')
|
|
486
|
+
}
|
|
487
|
+
};
|
|
487
488
|
if (extraConfig) {
|
|
488
489
|
Object.assign(config, extraConfig);
|
|
489
490
|
}
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
491
|
+
return axios.delete(endPoint,
|
|
492
|
+
data,
|
|
493
|
+
config
|
|
494
|
+
)
|
|
494
495
|
}
|
|
495
|
-
|
|
496
|
+
|
|
497
|
+
function doPut(endPoint, data, extraConfig) {
|
|
496
498
|
updateSession();
|
|
497
499
|
const config = {
|
|
498
500
|
headers: {
|
|
499
|
-
|
|
501
|
+
Authorization: 'Bearer ' + shStorage.getItem('access_token')
|
|
500
502
|
}
|
|
501
503
|
};
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
504
|
+
if (extraConfig) {
|
|
505
|
+
Object.assign(config, extraConfig);
|
|
506
|
+
}
|
|
505
507
|
return axios.put(endPoint,
|
|
506
508
|
data,
|
|
507
509
|
config
|
|
508
510
|
)
|
|
509
511
|
|
|
510
512
|
}
|
|
511
|
-
|
|
513
|
+
|
|
514
|
+
function doPatch(endPoint, data, extraConfig) {
|
|
512
515
|
updateSession();
|
|
513
516
|
const config = {
|
|
514
517
|
headers: {
|
|
515
|
-
|
|
518
|
+
Authorization: 'Bearer ' + shStorage.getItem('access_token')
|
|
516
519
|
}
|
|
517
520
|
};
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
+
if (extraConfig) {
|
|
522
|
+
Object.assign(config, extraConfig);
|
|
523
|
+
}
|
|
521
524
|
return axios.patch(endPoint,
|
|
522
525
|
data,
|
|
523
526
|
config
|
|
524
527
|
)
|
|
525
528
|
|
|
526
529
|
}
|
|
530
|
+
|
|
527
531
|
function graphQlQuery(query) {
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
+
const data = {
|
|
533
|
+
query
|
|
534
|
+
};
|
|
535
|
+
return doGet(graphQlEndpoint, data)
|
|
532
536
|
}
|
|
537
|
+
|
|
533
538
|
function graphQlMutate(mutation) {
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
539
|
+
const data = {
|
|
540
|
+
query: `mutation ${mutation}`
|
|
541
|
+
};
|
|
542
|
+
return doPost(graphQlEndpoint, data)
|
|
538
543
|
}
|
|
539
544
|
|
|
540
545
|
var shApis = {
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
546
|
+
doGet,
|
|
547
|
+
doPost,
|
|
548
|
+
graphQlQuery,
|
|
544
549
|
doDelete,
|
|
545
550
|
doPut,
|
|
546
551
|
doPatch,
|
|
547
|
-
|
|
552
|
+
graphQlMutate
|
|
548
553
|
};
|
|
549
554
|
|
|
550
555
|
const countries = [
|
|
@@ -7543,6 +7548,7 @@ const ShFrontend = {
|
|
|
7543
7548
|
const noRecordsComponent = options.noRecordsComponent ?? script$k;
|
|
7544
7549
|
const registrationFields = options.registrationFields ?? ['name','email','phone','password','password_confirmation'];
|
|
7545
7550
|
const AuthComponent = options.authComponent ?? script;
|
|
7551
|
+
const baseApiUrl = options.baseApiUrl ?? import.meta.env.VITE_APP_API_URL;
|
|
7546
7552
|
app.provide('loginEndpoint',loginEndpoint);
|
|
7547
7553
|
app.provide('registerEndpoint', registerEndpoint);
|
|
7548
7554
|
app.provide('registrationFields', registrationFields);
|
|
@@ -7558,6 +7564,7 @@ const ShFrontend = {
|
|
|
7558
7564
|
app.provide('noRecordsComponent',noRecordsComponent);
|
|
7559
7565
|
app.provide('forgotEndpoint',forgotEndpoint);
|
|
7560
7566
|
window.swalPosition = swalPosition;
|
|
7567
|
+
initApi(baseApiUrl);
|
|
7561
7568
|
if(options.router) {
|
|
7562
7569
|
options.router.addRoute({
|
|
7563
7570
|
path: '/sh-auth',
|