@etsoo/react 1.3.37 → 1.3.38

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.
@@ -25,6 +25,10 @@ export declare class ServiceApp<P extends IServicePageData = IServicePageData, U
25
25
  * @param name Application name
26
26
  */
27
27
  constructor(settings: S, name: string);
28
+ /**
29
+ * Go to the login page
30
+ */
31
+ toLoginPage(): void;
28
32
  /**
29
33
  * User login extended
30
34
  * @param user New user
@@ -1,4 +1,5 @@
1
1
  import { createClient } from '@etsoo/appscript';
2
+ import { DomUtils } from '@etsoo/shared';
2
3
  import { ReactApp } from './ReactApp';
3
4
  /**
4
5
  * Core Service App
@@ -24,6 +25,20 @@ export class ServiceApp extends ReactApp {
24
25
  this.setApi(api);
25
26
  this.coreApi = api;
26
27
  }
28
+ /**
29
+ * Go to the login page
30
+ */
31
+ toLoginPage() {
32
+ const coreUrl = this.settings.coreApi;
33
+ window.location.href =
34
+ coreUrl +
35
+ '?serviceId=' +
36
+ this.settings.serviceId +
37
+ '&' +
38
+ DomUtils.Culture +
39
+ '=' +
40
+ this.culture;
41
+ }
27
42
  /**
28
43
  * User login extended
29
44
  * @param user New user
@@ -36,6 +51,6 @@ export class ServiceApp extends ReactApp {
36
51
  // Core system user
37
52
  this.coreUser = coreUser;
38
53
  // Core system API token
39
- this.api.authorize(this.settings.authScheme, coreUser.token);
54
+ this.coreApi.authorize(this.settings.authScheme, coreUser.token);
40
55
  }
41
56
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@etsoo/react",
3
- "version": "1.3.37",
3
+ "version": "1.3.38",
4
4
  "description": "TypeScript ReactJs framework",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",
@@ -1,4 +1,5 @@
1
1
  import { createClient, IApi } from '@etsoo/appscript';
2
+ import { DomUtils } from '@etsoo/shared';
2
3
  import { ISmartERPUser } from '..';
3
4
  import { IServiceAppSettings } from './IServiceAppSettings';
4
5
  import { IServicePageData } from './IServicePage';
@@ -47,6 +48,21 @@ export class ServiceApp<
47
48
  this.coreApi = api;
48
49
  }
49
50
 
51
+ /**
52
+ * Go to the login page
53
+ */
54
+ override toLoginPage() {
55
+ const coreUrl = this.settings.coreApi;
56
+ window.location.href =
57
+ coreUrl +
58
+ '?serviceId=' +
59
+ this.settings.serviceId +
60
+ '&' +
61
+ DomUtils.Culture +
62
+ '=' +
63
+ this.culture;
64
+ }
65
+
50
66
  /**
51
67
  * User login extended
52
68
  * @param user New user
@@ -65,6 +81,6 @@ export class ServiceApp<
65
81
  this.coreUser = coreUser;
66
82
 
67
83
  // Core system API token
68
- this.api.authorize(this.settings.authScheme, coreUser.token);
84
+ this.coreApi.authorize(this.settings.authScheme, coreUser.token);
69
85
  }
70
86
  }