@etsoo/appscript 1.5.29 → 1.5.31

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.
@@ -1549,13 +1549,19 @@ class CoreApp {
1549
1549
  * @param apiUrl Signout API URL
1550
1550
  */
1551
1551
  async signout() {
1552
- await this.api.put('User/Signout', { deviceId: this.deviceId }, {
1553
- onError: (error) => {
1554
- console.error('CoreApp.signout error', error);
1555
- // Prevent further processing
1556
- return false;
1557
- }
1558
- });
1552
+ const token = this.getCacheToken();
1553
+ if (token) {
1554
+ await this.api.put('Auth/Signout', {
1555
+ deviceId: this.deviceId,
1556
+ token: this.encrypt(token)
1557
+ }, {
1558
+ onError: (error) => {
1559
+ console.error('CoreApp.signout error', error);
1560
+ // Prevent further processing
1561
+ return false;
1562
+ }
1563
+ });
1564
+ }
1559
1565
  // Clear, noTrigger = true, avoid state update
1560
1566
  this.userLogout(true, true);
1561
1567
  // Go to login page
@@ -17,11 +17,6 @@ export declare class AuthApi extends BaseApi {
17
17
  * @returns Result
18
18
  */
19
19
  protected loginBase<T extends IUser>(rq: LoginRQ, payload?: IApiPayload<IActionResult<T>>, tokenKey?: string): Promise<[IActionResult<T> | undefined, string | null]>;
20
- /**
21
- * Get log in url
22
- * @returns Url
23
- */
24
- getLogInUrl(): Promise<string | undefined>;
25
20
  /**
26
21
  * Login id check
27
22
  * @param id Check id
@@ -29,10 +24,6 @@ export declare class AuthApi extends BaseApi {
29
24
  * @returns Result
30
25
  */
31
26
  loginId(id: string, payload?: ResultPayload): Promise<IActionResult<{}> | undefined>;
32
- /**
33
- * Redirect to log in url
34
- */
35
- redirectToLogInUrl(): Promise<void>;
36
27
  /**
37
28
  * Reset password
38
29
  * @param rq Request data
@@ -21,16 +21,6 @@ class AuthApi extends BaseApi_1.BaseApi {
21
21
  : null;
22
22
  return [result, refreshToken];
23
23
  }
24
- /**
25
- * Get log in url
26
- * @returns Url
27
- */
28
- getLogInUrl() {
29
- return this.api.get('Auth/GetLogInUrl', {
30
- region: this.app.region,
31
- device: this.app.deviceId
32
- });
33
- }
34
24
  /**
35
25
  * Login id check
36
26
  * @param id Check id
@@ -47,15 +37,6 @@ class AuthApi extends BaseApi_1.BaseApi {
47
37
  };
48
38
  return this.api.post('Auth/LoginId', rq, payload);
49
39
  }
50
- /**
51
- * Redirect to log in url
52
- */
53
- async redirectToLogInUrl() {
54
- const url = await this.getLogInUrl();
55
- if (url == null)
56
- return;
57
- globalThis.location.replace(url);
58
- }
59
40
  /**
60
41
  * Reset password
61
42
  * @param rq Request data
@@ -1546,13 +1546,19 @@ export class CoreApp {
1546
1546
  * @param apiUrl Signout API URL
1547
1547
  */
1548
1548
  async signout() {
1549
- await this.api.put('User/Signout', { deviceId: this.deviceId }, {
1550
- onError: (error) => {
1551
- console.error('CoreApp.signout error', error);
1552
- // Prevent further processing
1553
- return false;
1554
- }
1555
- });
1549
+ const token = this.getCacheToken();
1550
+ if (token) {
1551
+ await this.api.put('Auth/Signout', {
1552
+ deviceId: this.deviceId,
1553
+ token: this.encrypt(token)
1554
+ }, {
1555
+ onError: (error) => {
1556
+ console.error('CoreApp.signout error', error);
1557
+ // Prevent further processing
1558
+ return false;
1559
+ }
1560
+ });
1561
+ }
1556
1562
  // Clear, noTrigger = true, avoid state update
1557
1563
  this.userLogout(true, true);
1558
1564
  // Go to login page
@@ -17,11 +17,6 @@ export declare class AuthApi extends BaseApi {
17
17
  * @returns Result
18
18
  */
19
19
  protected loginBase<T extends IUser>(rq: LoginRQ, payload?: IApiPayload<IActionResult<T>>, tokenKey?: string): Promise<[IActionResult<T> | undefined, string | null]>;
20
- /**
21
- * Get log in url
22
- * @returns Url
23
- */
24
- getLogInUrl(): Promise<string | undefined>;
25
20
  /**
26
21
  * Login id check
27
22
  * @param id Check id
@@ -29,10 +24,6 @@ export declare class AuthApi extends BaseApi {
29
24
  * @returns Result
30
25
  */
31
26
  loginId(id: string, payload?: ResultPayload): Promise<IActionResult<{}> | undefined>;
32
- /**
33
- * Redirect to log in url
34
- */
35
- redirectToLogInUrl(): Promise<void>;
36
27
  /**
37
28
  * Reset password
38
29
  * @param rq Request data
@@ -18,16 +18,6 @@ export class AuthApi extends BaseApi {
18
18
  : null;
19
19
  return [result, refreshToken];
20
20
  }
21
- /**
22
- * Get log in url
23
- * @returns Url
24
- */
25
- getLogInUrl() {
26
- return this.api.get('Auth/GetLogInUrl', {
27
- region: this.app.region,
28
- device: this.app.deviceId
29
- });
30
- }
31
21
  /**
32
22
  * Login id check
33
23
  * @param id Check id
@@ -44,15 +34,6 @@ export class AuthApi extends BaseApi {
44
34
  };
45
35
  return this.api.post('Auth/LoginId', rq, payload);
46
36
  }
47
- /**
48
- * Redirect to log in url
49
- */
50
- async redirectToLogInUrl() {
51
- const url = await this.getLogInUrl();
52
- if (url == null)
53
- return;
54
- globalThis.location.replace(url);
55
- }
56
37
  /**
57
38
  * Reset password
58
39
  * @param rq Request data
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@etsoo/appscript",
3
- "version": "1.5.29",
3
+ "version": "1.5.31",
4
4
  "description": "Applications shared TypeScript framework",
5
5
  "main": "lib/cjs/index.js",
6
6
  "module": "lib/mjs/index.js",
@@ -2126,17 +2126,23 @@ export abstract class CoreApp<
2126
2126
  * @param apiUrl Signout API URL
2127
2127
  */
2128
2128
  async signout() {
2129
- await this.api.put<boolean>(
2130
- 'User/Signout',
2131
- { deviceId: this.deviceId },
2132
- {
2133
- onError: (error) => {
2134
- console.error('CoreApp.signout error', error);
2135
- // Prevent further processing
2136
- return false;
2129
+ const token = this.getCacheToken();
2130
+ if (token) {
2131
+ await this.api.put<boolean>(
2132
+ 'Auth/Signout',
2133
+ {
2134
+ deviceId: this.deviceId,
2135
+ token: this.encrypt(token)
2136
+ },
2137
+ {
2138
+ onError: (error) => {
2139
+ console.error('CoreApp.signout error', error);
2140
+ // Prevent further processing
2141
+ return false;
2142
+ }
2137
2143
  }
2138
- }
2139
- );
2144
+ );
2145
+ }
2140
2146
 
2141
2147
  // Clear, noTrigger = true, avoid state update
2142
2148
  this.userLogout(true, true);
@@ -31,17 +31,6 @@ export class AuthApi extends BaseApi {
31
31
  return [result, refreshToken];
32
32
  }
33
33
 
34
- /**
35
- * Get log in url
36
- * @returns Url
37
- */
38
- getLogInUrl() {
39
- return this.api.get<string>('Auth/GetLogInUrl', {
40
- region: this.app.region,
41
- device: this.app.deviceId
42
- });
43
- }
44
-
45
34
  /**
46
35
  * Login id check
47
36
  * @param id Check id
@@ -59,15 +48,6 @@ export class AuthApi extends BaseApi {
59
48
  return this.api.post('Auth/LoginId', rq, payload);
60
49
  }
61
50
 
62
- /**
63
- * Redirect to log in url
64
- */
65
- async redirectToLogInUrl() {
66
- const url = await this.getLogInUrl();
67
- if (url == null) return;
68
- globalThis.location.replace(url);
69
- }
70
-
71
51
  /**
72
52
  * Reset password
73
53
  * @param rq Request data