@etsoo/appscript 1.1.81 → 1.1.85
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/__tests__/app/CoreApp.ts +12 -0
- package/lib/cjs/app/CoreApp.d.ts +30 -4
- package/lib/cjs/app/CoreApp.js +29 -7
- package/lib/cjs/app/ExternalSettings.d.ts +7 -7
- package/lib/mjs/app/CoreApp.d.ts +30 -4
- package/lib/mjs/app/CoreApp.js +29 -7
- package/lib/mjs/app/ExternalSettings.d.ts +7 -7
- package/package.json +1 -1
- package/src/app/CoreApp.ts +49 -12
- package/src/app/ExternalSettings.ts +7 -7
package/__tests__/app/CoreApp.ts
CHANGED
|
@@ -129,6 +129,18 @@ test('Tests for encrypt / decrypt', () => {
|
|
|
129
129
|
expect(plain).toEqual(input);
|
|
130
130
|
});
|
|
131
131
|
|
|
132
|
+
test('Tests for encryptEnhanced / decryptEnhanced', () => {
|
|
133
|
+
// Arrange
|
|
134
|
+
const input = 'Hello, world!';
|
|
135
|
+
const passphrase = 'My password';
|
|
136
|
+
|
|
137
|
+
// Act
|
|
138
|
+
const encrypted = app.encryptEnhanced(input, passphrase);
|
|
139
|
+
console.log(encrypted);
|
|
140
|
+
const plain = app.decryptEnhanced(encrypted, passphrase);
|
|
141
|
+
expect(plain).toEqual(input);
|
|
142
|
+
});
|
|
143
|
+
|
|
132
144
|
test('Tests for initCallUpdateLocal', () => {
|
|
133
145
|
// Act
|
|
134
146
|
const passphrase = app.initCallUpdateLocal(
|
package/lib/cjs/app/CoreApp.d.ts
CHANGED
|
@@ -2,8 +2,10 @@ import { INotifier, NotificationAlign, NotificationCallProps, NotificationConten
|
|
|
2
2
|
import { ApiDataError, IApi, IPData } from '@etsoo/restclient';
|
|
3
3
|
import { DataTypes, DateUtils } from '@etsoo/shared';
|
|
4
4
|
import { AddressRegion } from '../address/AddressRegion';
|
|
5
|
+
import { IdLabelDto } from '../dto/IdLabelDto';
|
|
6
|
+
import { InitCallDto } from '../dto/InitCallDto';
|
|
5
7
|
import { IActionResult } from '../result/IActionResult';
|
|
6
|
-
import { InitCallResultData } from '../result/InitCallResult';
|
|
8
|
+
import { InitCallResult, InitCallResultData } from '../result/InitCallResult';
|
|
7
9
|
import { IUserData } from '../state/User';
|
|
8
10
|
import { IAppSettings } from './AppSettings';
|
|
9
11
|
import { UserRole } from './UserRole';
|
|
@@ -26,7 +28,7 @@ export interface RefreshTokenProps<D extends {}> {
|
|
|
26
28
|
/**
|
|
27
29
|
* Callback
|
|
28
30
|
*/
|
|
29
|
-
callback?: (result: RefreshTokenResult) => void;
|
|
31
|
+
callback?: (result: RefreshTokenResult, successData?: string) => void;
|
|
30
32
|
/**
|
|
31
33
|
* Data to pass
|
|
32
34
|
*/
|
|
@@ -277,6 +279,13 @@ export interface ICoreApp<S extends IAppSettings, N, C extends NotificationCallP
|
|
|
277
279
|
* @param apiUrl Signout API URL
|
|
278
280
|
*/
|
|
279
281
|
signout(apiUrl?: string): Promise<void>;
|
|
282
|
+
/**
|
|
283
|
+
* Get organization list
|
|
284
|
+
* @param items Max items
|
|
285
|
+
* @param serviceId Service id
|
|
286
|
+
* @returns Result
|
|
287
|
+
*/
|
|
288
|
+
orgList(items?: number, serviceId?: number): Promise<IdLabelDto[] | undefined>;
|
|
280
289
|
/**
|
|
281
290
|
* Switch organization
|
|
282
291
|
* @param apiOrOrg API URL or organization id
|
|
@@ -402,6 +411,10 @@ export declare abstract class CoreApp<S extends IAppSettings, N, C extends Notif
|
|
|
402
411
|
* Device id field name
|
|
403
412
|
*/
|
|
404
413
|
protected deviceIdField: string;
|
|
414
|
+
/**
|
|
415
|
+
* Init call Api URL
|
|
416
|
+
*/
|
|
417
|
+
protected initCallApi: string;
|
|
405
418
|
/**
|
|
406
419
|
* Passphrase for encryption
|
|
407
420
|
*/
|
|
@@ -416,6 +429,12 @@ export declare abstract class CoreApp<S extends IAppSettings, N, C extends Notif
|
|
|
416
429
|
*/
|
|
417
430
|
protected constructor(settings: S, api: IApi, notifier: INotifier<N, C>, name: string);
|
|
418
431
|
protected setApi(api: IApi): void;
|
|
432
|
+
/**
|
|
433
|
+
* Api init call
|
|
434
|
+
* @param data Data
|
|
435
|
+
* @returns Result
|
|
436
|
+
*/
|
|
437
|
+
protected apiInitCall(data: InitCallDto): Promise<InitCallResult | undefined>;
|
|
419
438
|
/**
|
|
420
439
|
* Init call
|
|
421
440
|
* @param callback Callback
|
|
@@ -626,11 +645,18 @@ export declare abstract class CoreApp<S extends IAppSettings, N, C extends Notif
|
|
|
626
645
|
* @param apiUrl Signout API URL
|
|
627
646
|
*/
|
|
628
647
|
signout(apiUrl?: string): Promise<void>;
|
|
648
|
+
/**
|
|
649
|
+
* Get organization list
|
|
650
|
+
* @param items Max items
|
|
651
|
+
* @param serviceId Service id
|
|
652
|
+
* @returns Result
|
|
653
|
+
*/
|
|
654
|
+
orgList(items?: number, serviceId?: number): Promise<IdLabelDto<number>[] | undefined>;
|
|
629
655
|
/**
|
|
630
656
|
* Switch organization
|
|
631
|
-
* @param
|
|
657
|
+
* @param id Organization id
|
|
632
658
|
*/
|
|
633
|
-
switchOrg(
|
|
659
|
+
switchOrg(id: number): Promise<boolean | undefined>;
|
|
634
660
|
/**
|
|
635
661
|
* Go to the login page
|
|
636
662
|
*/
|
package/lib/cjs/app/CoreApp.js
CHANGED
|
@@ -39,6 +39,10 @@ class CoreApp {
|
|
|
39
39
|
* Device id field name
|
|
40
40
|
*/
|
|
41
41
|
this.deviceIdField = 'SmartERPDeviceId';
|
|
42
|
+
/**
|
|
43
|
+
* Init call Api URL
|
|
44
|
+
*/
|
|
45
|
+
this.initCallApi = 'Auth/WebInitCall';
|
|
42
46
|
/**
|
|
43
47
|
* Passphrase for encryption
|
|
44
48
|
*/
|
|
@@ -127,6 +131,14 @@ class CoreApp {
|
|
|
127
131
|
}
|
|
128
132
|
};
|
|
129
133
|
}
|
|
134
|
+
/**
|
|
135
|
+
* Api init call
|
|
136
|
+
* @param data Data
|
|
137
|
+
* @returns Result
|
|
138
|
+
*/
|
|
139
|
+
async apiInitCall(data) {
|
|
140
|
+
return await this.api.put(this.initCallApi, data);
|
|
141
|
+
}
|
|
130
142
|
/**
|
|
131
143
|
* Init call
|
|
132
144
|
* @param callback Callback
|
|
@@ -138,7 +150,7 @@ class CoreApp {
|
|
|
138
150
|
timestamp: new Date().getTime(),
|
|
139
151
|
deviceId: this.deviceId === '' ? undefined : this.deviceId
|
|
140
152
|
};
|
|
141
|
-
const result = await this.
|
|
153
|
+
const result = await this.apiInitCall(data);
|
|
142
154
|
if (result == null) {
|
|
143
155
|
if (callback)
|
|
144
156
|
callback(false);
|
|
@@ -687,7 +699,7 @@ class CoreApp {
|
|
|
687
699
|
*/
|
|
688
700
|
async refreshToken(props) {
|
|
689
701
|
if (props && props.callback)
|
|
690
|
-
props.callback(true);
|
|
702
|
+
props.callback(true, undefined);
|
|
691
703
|
return true;
|
|
692
704
|
}
|
|
693
705
|
/**
|
|
@@ -711,14 +723,24 @@ class CoreApp {
|
|
|
711
723
|
// Go to login page
|
|
712
724
|
this.toLoginPage();
|
|
713
725
|
}
|
|
726
|
+
/**
|
|
727
|
+
* Get organization list
|
|
728
|
+
* @param items Max items
|
|
729
|
+
* @param serviceId Service id
|
|
730
|
+
* @returns Result
|
|
731
|
+
*/
|
|
732
|
+
async orgList(items, serviceId) {
|
|
733
|
+
return await this.api.post('Organization/List', {
|
|
734
|
+
items,
|
|
735
|
+
serviceId
|
|
736
|
+
}, { defaultValue: [], showLoading: false });
|
|
737
|
+
}
|
|
714
738
|
/**
|
|
715
739
|
* Switch organization
|
|
716
|
-
* @param
|
|
740
|
+
* @param id Organization id
|
|
717
741
|
*/
|
|
718
|
-
async switchOrg(
|
|
719
|
-
const api =
|
|
720
|
-
? `Organization/Switch/${apiOrOrg}`
|
|
721
|
-
: apiOrOrg;
|
|
742
|
+
async switchOrg(id) {
|
|
743
|
+
const api = `Organization/Switch/${id}`;
|
|
722
744
|
const result = await this.api.put(api);
|
|
723
745
|
if (result)
|
|
724
746
|
return await this.refreshToken();
|
|
@@ -3,25 +3,25 @@
|
|
|
3
3
|
*/
|
|
4
4
|
export interface IExternalSettings {
|
|
5
5
|
/**
|
|
6
|
-
* API endpoint
|
|
6
|
+
* Core system API endpoint
|
|
7
7
|
*/
|
|
8
8
|
readonly endpoint: string;
|
|
9
9
|
/**
|
|
10
|
-
*
|
|
10
|
+
* Core system app root url
|
|
11
11
|
*/
|
|
12
12
|
readonly homepage: string;
|
|
13
13
|
/**
|
|
14
|
-
*
|
|
14
|
+
* Core system web url
|
|
15
15
|
*/
|
|
16
16
|
readonly webUrl: string;
|
|
17
17
|
/**
|
|
18
|
-
*
|
|
18
|
+
* Service API endpoint
|
|
19
19
|
*/
|
|
20
|
-
readonly
|
|
20
|
+
readonly serviceEndpoint?: string;
|
|
21
21
|
/**
|
|
22
|
-
*
|
|
22
|
+
* Service web Url
|
|
23
23
|
*/
|
|
24
|
-
readonly
|
|
24
|
+
readonly serviceUrl?: string;
|
|
25
25
|
}
|
|
26
26
|
/**
|
|
27
27
|
* External settings namespace
|
package/lib/mjs/app/CoreApp.d.ts
CHANGED
|
@@ -2,8 +2,10 @@ import { INotifier, NotificationAlign, NotificationCallProps, NotificationConten
|
|
|
2
2
|
import { ApiDataError, IApi, IPData } from '@etsoo/restclient';
|
|
3
3
|
import { DataTypes, DateUtils } from '@etsoo/shared';
|
|
4
4
|
import { AddressRegion } from '../address/AddressRegion';
|
|
5
|
+
import { IdLabelDto } from '../dto/IdLabelDto';
|
|
6
|
+
import { InitCallDto } from '../dto/InitCallDto';
|
|
5
7
|
import { IActionResult } from '../result/IActionResult';
|
|
6
|
-
import { InitCallResultData } from '../result/InitCallResult';
|
|
8
|
+
import { InitCallResult, InitCallResultData } from '../result/InitCallResult';
|
|
7
9
|
import { IUserData } from '../state/User';
|
|
8
10
|
import { IAppSettings } from './AppSettings';
|
|
9
11
|
import { UserRole } from './UserRole';
|
|
@@ -26,7 +28,7 @@ export interface RefreshTokenProps<D extends {}> {
|
|
|
26
28
|
/**
|
|
27
29
|
* Callback
|
|
28
30
|
*/
|
|
29
|
-
callback?: (result: RefreshTokenResult) => void;
|
|
31
|
+
callback?: (result: RefreshTokenResult, successData?: string) => void;
|
|
30
32
|
/**
|
|
31
33
|
* Data to pass
|
|
32
34
|
*/
|
|
@@ -277,6 +279,13 @@ export interface ICoreApp<S extends IAppSettings, N, C extends NotificationCallP
|
|
|
277
279
|
* @param apiUrl Signout API URL
|
|
278
280
|
*/
|
|
279
281
|
signout(apiUrl?: string): Promise<void>;
|
|
282
|
+
/**
|
|
283
|
+
* Get organization list
|
|
284
|
+
* @param items Max items
|
|
285
|
+
* @param serviceId Service id
|
|
286
|
+
* @returns Result
|
|
287
|
+
*/
|
|
288
|
+
orgList(items?: number, serviceId?: number): Promise<IdLabelDto[] | undefined>;
|
|
280
289
|
/**
|
|
281
290
|
* Switch organization
|
|
282
291
|
* @param apiOrOrg API URL or organization id
|
|
@@ -402,6 +411,10 @@ export declare abstract class CoreApp<S extends IAppSettings, N, C extends Notif
|
|
|
402
411
|
* Device id field name
|
|
403
412
|
*/
|
|
404
413
|
protected deviceIdField: string;
|
|
414
|
+
/**
|
|
415
|
+
* Init call Api URL
|
|
416
|
+
*/
|
|
417
|
+
protected initCallApi: string;
|
|
405
418
|
/**
|
|
406
419
|
* Passphrase for encryption
|
|
407
420
|
*/
|
|
@@ -416,6 +429,12 @@ export declare abstract class CoreApp<S extends IAppSettings, N, C extends Notif
|
|
|
416
429
|
*/
|
|
417
430
|
protected constructor(settings: S, api: IApi, notifier: INotifier<N, C>, name: string);
|
|
418
431
|
protected setApi(api: IApi): void;
|
|
432
|
+
/**
|
|
433
|
+
* Api init call
|
|
434
|
+
* @param data Data
|
|
435
|
+
* @returns Result
|
|
436
|
+
*/
|
|
437
|
+
protected apiInitCall(data: InitCallDto): Promise<InitCallResult | undefined>;
|
|
419
438
|
/**
|
|
420
439
|
* Init call
|
|
421
440
|
* @param callback Callback
|
|
@@ -626,11 +645,18 @@ export declare abstract class CoreApp<S extends IAppSettings, N, C extends Notif
|
|
|
626
645
|
* @param apiUrl Signout API URL
|
|
627
646
|
*/
|
|
628
647
|
signout(apiUrl?: string): Promise<void>;
|
|
648
|
+
/**
|
|
649
|
+
* Get organization list
|
|
650
|
+
* @param items Max items
|
|
651
|
+
* @param serviceId Service id
|
|
652
|
+
* @returns Result
|
|
653
|
+
*/
|
|
654
|
+
orgList(items?: number, serviceId?: number): Promise<IdLabelDto<number>[] | undefined>;
|
|
629
655
|
/**
|
|
630
656
|
* Switch organization
|
|
631
|
-
* @param
|
|
657
|
+
* @param id Organization id
|
|
632
658
|
*/
|
|
633
|
-
switchOrg(
|
|
659
|
+
switchOrg(id: number): Promise<boolean | undefined>;
|
|
634
660
|
/**
|
|
635
661
|
* Go to the login page
|
|
636
662
|
*/
|
package/lib/mjs/app/CoreApp.js
CHANGED
|
@@ -36,6 +36,10 @@ export class CoreApp {
|
|
|
36
36
|
* Device id field name
|
|
37
37
|
*/
|
|
38
38
|
this.deviceIdField = 'SmartERPDeviceId';
|
|
39
|
+
/**
|
|
40
|
+
* Init call Api URL
|
|
41
|
+
*/
|
|
42
|
+
this.initCallApi = 'Auth/WebInitCall';
|
|
39
43
|
/**
|
|
40
44
|
* Passphrase for encryption
|
|
41
45
|
*/
|
|
@@ -124,6 +128,14 @@ export class CoreApp {
|
|
|
124
128
|
}
|
|
125
129
|
};
|
|
126
130
|
}
|
|
131
|
+
/**
|
|
132
|
+
* Api init call
|
|
133
|
+
* @param data Data
|
|
134
|
+
* @returns Result
|
|
135
|
+
*/
|
|
136
|
+
async apiInitCall(data) {
|
|
137
|
+
return await this.api.put(this.initCallApi, data);
|
|
138
|
+
}
|
|
127
139
|
/**
|
|
128
140
|
* Init call
|
|
129
141
|
* @param callback Callback
|
|
@@ -135,7 +147,7 @@ export class CoreApp {
|
|
|
135
147
|
timestamp: new Date().getTime(),
|
|
136
148
|
deviceId: this.deviceId === '' ? undefined : this.deviceId
|
|
137
149
|
};
|
|
138
|
-
const result = await this.
|
|
150
|
+
const result = await this.apiInitCall(data);
|
|
139
151
|
if (result == null) {
|
|
140
152
|
if (callback)
|
|
141
153
|
callback(false);
|
|
@@ -684,7 +696,7 @@ export class CoreApp {
|
|
|
684
696
|
*/
|
|
685
697
|
async refreshToken(props) {
|
|
686
698
|
if (props && props.callback)
|
|
687
|
-
props.callback(true);
|
|
699
|
+
props.callback(true, undefined);
|
|
688
700
|
return true;
|
|
689
701
|
}
|
|
690
702
|
/**
|
|
@@ -708,14 +720,24 @@ export class CoreApp {
|
|
|
708
720
|
// Go to login page
|
|
709
721
|
this.toLoginPage();
|
|
710
722
|
}
|
|
723
|
+
/**
|
|
724
|
+
* Get organization list
|
|
725
|
+
* @param items Max items
|
|
726
|
+
* @param serviceId Service id
|
|
727
|
+
* @returns Result
|
|
728
|
+
*/
|
|
729
|
+
async orgList(items, serviceId) {
|
|
730
|
+
return await this.api.post('Organization/List', {
|
|
731
|
+
items,
|
|
732
|
+
serviceId
|
|
733
|
+
}, { defaultValue: [], showLoading: false });
|
|
734
|
+
}
|
|
711
735
|
/**
|
|
712
736
|
* Switch organization
|
|
713
|
-
* @param
|
|
737
|
+
* @param id Organization id
|
|
714
738
|
*/
|
|
715
|
-
async switchOrg(
|
|
716
|
-
const api =
|
|
717
|
-
? `Organization/Switch/${apiOrOrg}`
|
|
718
|
-
: apiOrOrg;
|
|
739
|
+
async switchOrg(id) {
|
|
740
|
+
const api = `Organization/Switch/${id}`;
|
|
719
741
|
const result = await this.api.put(api);
|
|
720
742
|
if (result)
|
|
721
743
|
return await this.refreshToken();
|
|
@@ -3,25 +3,25 @@
|
|
|
3
3
|
*/
|
|
4
4
|
export interface IExternalSettings {
|
|
5
5
|
/**
|
|
6
|
-
* API endpoint
|
|
6
|
+
* Core system API endpoint
|
|
7
7
|
*/
|
|
8
8
|
readonly endpoint: string;
|
|
9
9
|
/**
|
|
10
|
-
*
|
|
10
|
+
* Core system app root url
|
|
11
11
|
*/
|
|
12
12
|
readonly homepage: string;
|
|
13
13
|
/**
|
|
14
|
-
*
|
|
14
|
+
* Core system web url
|
|
15
15
|
*/
|
|
16
16
|
readonly webUrl: string;
|
|
17
17
|
/**
|
|
18
|
-
*
|
|
18
|
+
* Service API endpoint
|
|
19
19
|
*/
|
|
20
|
-
readonly
|
|
20
|
+
readonly serviceEndpoint?: string;
|
|
21
21
|
/**
|
|
22
|
-
*
|
|
22
|
+
* Service web Url
|
|
23
23
|
*/
|
|
24
|
-
readonly
|
|
24
|
+
readonly serviceUrl?: string;
|
|
25
25
|
}
|
|
26
26
|
/**
|
|
27
27
|
* External settings namespace
|
package/package.json
CHANGED
package/src/app/CoreApp.ts
CHANGED
|
@@ -28,6 +28,7 @@ import {
|
|
|
28
28
|
} from 'crypto-js';
|
|
29
29
|
import { AddressRegion } from '../address/AddressRegion';
|
|
30
30
|
import { AddressUtils } from '../address/AddressUtils';
|
|
31
|
+
import { IdLabelDto } from '../dto/IdLabelDto';
|
|
31
32
|
import { InitCallDto } from '../dto/InitCallDto';
|
|
32
33
|
import { ActionResultError } from '../result/ActionResultError';
|
|
33
34
|
import { IActionResult } from '../result/IActionResult';
|
|
@@ -61,7 +62,7 @@ export interface RefreshTokenProps<D extends {}> {
|
|
|
61
62
|
/**
|
|
62
63
|
* Callback
|
|
63
64
|
*/
|
|
64
|
-
callback?: (result: RefreshTokenResult) => void;
|
|
65
|
+
callback?: (result: RefreshTokenResult, successData?: string) => void;
|
|
65
66
|
|
|
66
67
|
/**
|
|
67
68
|
* Data to pass
|
|
@@ -382,6 +383,17 @@ export interface ICoreApp<
|
|
|
382
383
|
*/
|
|
383
384
|
signout(apiUrl?: string): Promise<void>;
|
|
384
385
|
|
|
386
|
+
/**
|
|
387
|
+
* Get organization list
|
|
388
|
+
* @param items Max items
|
|
389
|
+
* @param serviceId Service id
|
|
390
|
+
* @returns Result
|
|
391
|
+
*/
|
|
392
|
+
orgList(
|
|
393
|
+
items?: number,
|
|
394
|
+
serviceId?: number
|
|
395
|
+
): Promise<IdLabelDto[] | undefined>;
|
|
396
|
+
|
|
385
397
|
/**
|
|
386
398
|
* Switch organization
|
|
387
399
|
* @param apiOrOrg API URL or organization id
|
|
@@ -557,6 +569,11 @@ export abstract class CoreApp<
|
|
|
557
569
|
*/
|
|
558
570
|
protected deviceIdField: string = 'SmartERPDeviceId';
|
|
559
571
|
|
|
572
|
+
/**
|
|
573
|
+
* Init call Api URL
|
|
574
|
+
*/
|
|
575
|
+
protected initCallApi: string = 'Auth/WebInitCall';
|
|
576
|
+
|
|
560
577
|
/**
|
|
561
578
|
* Passphrase for encryption
|
|
562
579
|
*/
|
|
@@ -631,6 +648,15 @@ export abstract class CoreApp<
|
|
|
631
648
|
};
|
|
632
649
|
}
|
|
633
650
|
|
|
651
|
+
/**
|
|
652
|
+
* Api init call
|
|
653
|
+
* @param data Data
|
|
654
|
+
* @returns Result
|
|
655
|
+
*/
|
|
656
|
+
protected async apiInitCall(data: InitCallDto) {
|
|
657
|
+
return await this.api.put<InitCallResult>(this.initCallApi, data);
|
|
658
|
+
}
|
|
659
|
+
|
|
634
660
|
/**
|
|
635
661
|
* Init call
|
|
636
662
|
* @param callback Callback
|
|
@@ -641,10 +667,7 @@ export abstract class CoreApp<
|
|
|
641
667
|
timestamp: new Date().getTime(),
|
|
642
668
|
deviceId: this.deviceId === '' ? undefined : this.deviceId
|
|
643
669
|
};
|
|
644
|
-
const result = await this.
|
|
645
|
-
'Auth/WebInitCall',
|
|
646
|
-
data
|
|
647
|
-
);
|
|
670
|
+
const result = await this.apiInitCall(data);
|
|
648
671
|
if (result == null) {
|
|
649
672
|
if (callback) callback(false);
|
|
650
673
|
return;
|
|
@@ -1310,7 +1333,7 @@ export abstract class CoreApp<
|
|
|
1310
1333
|
* @param props Props
|
|
1311
1334
|
*/
|
|
1312
1335
|
async refreshToken<D extends {} = {}>(props?: RefreshTokenProps<D>) {
|
|
1313
|
-
if (props && props.callback) props.callback(true);
|
|
1336
|
+
if (props && props.callback) props.callback(true, undefined);
|
|
1314
1337
|
return true;
|
|
1315
1338
|
}
|
|
1316
1339
|
|
|
@@ -1339,15 +1362,29 @@ export abstract class CoreApp<
|
|
|
1339
1362
|
this.toLoginPage();
|
|
1340
1363
|
}
|
|
1341
1364
|
|
|
1365
|
+
/**
|
|
1366
|
+
* Get organization list
|
|
1367
|
+
* @param items Max items
|
|
1368
|
+
* @param serviceId Service id
|
|
1369
|
+
* @returns Result
|
|
1370
|
+
*/
|
|
1371
|
+
async orgList(items?: number, serviceId?: number) {
|
|
1372
|
+
return await this.api.post<IdLabelDto[]>(
|
|
1373
|
+
'Organization/List',
|
|
1374
|
+
{
|
|
1375
|
+
items,
|
|
1376
|
+
serviceId
|
|
1377
|
+
},
|
|
1378
|
+
{ defaultValue: [], showLoading: false }
|
|
1379
|
+
);
|
|
1380
|
+
}
|
|
1381
|
+
|
|
1342
1382
|
/**
|
|
1343
1383
|
* Switch organization
|
|
1344
|
-
* @param
|
|
1384
|
+
* @param id Organization id
|
|
1345
1385
|
*/
|
|
1346
|
-
async switchOrg(
|
|
1347
|
-
const api =
|
|
1348
|
-
typeof apiOrOrg === 'number'
|
|
1349
|
-
? `Organization/Switch/${apiOrOrg}`
|
|
1350
|
-
: apiOrOrg;
|
|
1386
|
+
async switchOrg(id: number) {
|
|
1387
|
+
const api = `Organization/Switch/${id}`;
|
|
1351
1388
|
const result = await this.api.put<boolean>(api);
|
|
1352
1389
|
if (result) return await this.refreshToken();
|
|
1353
1390
|
return result;
|
|
@@ -3,29 +3,29 @@
|
|
|
3
3
|
*/
|
|
4
4
|
export interface IExternalSettings {
|
|
5
5
|
/**
|
|
6
|
-
* API endpoint
|
|
6
|
+
* Core system API endpoint
|
|
7
7
|
*/
|
|
8
8
|
readonly endpoint: string;
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
|
-
*
|
|
11
|
+
* Core system app root url
|
|
12
12
|
*/
|
|
13
13
|
readonly homepage: string;
|
|
14
14
|
|
|
15
15
|
/**
|
|
16
|
-
*
|
|
16
|
+
* Core system web url
|
|
17
17
|
*/
|
|
18
18
|
readonly webUrl: string;
|
|
19
19
|
|
|
20
20
|
/**
|
|
21
|
-
*
|
|
21
|
+
* Service API endpoint
|
|
22
22
|
*/
|
|
23
|
-
readonly
|
|
23
|
+
readonly serviceEndpoint?: string;
|
|
24
24
|
|
|
25
25
|
/**
|
|
26
|
-
*
|
|
26
|
+
* Service web Url
|
|
27
27
|
*/
|
|
28
|
-
readonly
|
|
28
|
+
readonly serviceUrl?: string;
|
|
29
29
|
}
|
|
30
30
|
|
|
31
31
|
/**
|