@gandalan/weblibs 1.0.0 → 1.0.2

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/README.md CHANGED
@@ -4,27 +4,28 @@ WebLibs for Gandalan JS/TS/Svelte projects
4
4
 
5
5
 
6
6
  ```js
7
- import { IDAS } from '@gandalan/weblibs/api/IDAS';
8
- let idas = new IDAS();
9
-
10
- // bei Bedarf wird der Client zur Anmeldung umgeleitet, danach wird die aktuelle Seite wieder aufgerufen
11
- idas.authenticateWithSSO();
7
+ import { IDASFactory } from '@gandalan/weblibs';
8
+ let idas = IDASFactory.create();
12
9
  ```
13
10
 
11
+ IDAS ab Version 1.0.0 verwendet JWT-Token für die Authentifizierung mit WebAPI.
12
+
14
13
  Danach z.B. Zugriff auf die Mandant-Guid:
15
14
 
16
15
  ```js
17
- let mandantGuid = idas.mandantGuid;
16
+ let mandantGuid = await idas.then(i => i.mandantGuid);
18
17
  ```
19
18
 
20
19
  Datenzugriffe erfolgen über die Objekte innerhalb der IDAS-Klasse
21
20
 
22
21
  ```js
23
22
  let loader = Promise.all([
24
- idas.mandanten.getAll()
23
+ idas.
24
+ .then(i => i.mandanten.getAll())
25
25
  .then(d => mandanten = d.sort((a,b) => a.Name.localeCompare(b.Name)))
26
26
  .catch(e => error = e),
27
- idas.rollen.getAll()
27
+ idas
28
+ .then(i => i.rollen.getAll())
28
29
  .then(d => rollen = d.sort((a,b) => a.Name.localeCompare(b.Name)))
29
30
  .catch(e => error = e)
30
31
  ])
package/api/IDAS.js CHANGED
@@ -51,7 +51,7 @@ class IDAS {
51
51
 
52
52
  // still not valid JWT -> authenticate
53
53
  if (!refreshClient.token) {
54
- localStorage.setItem('IDAS_AuthJwtCallbackPath', authPath);
54
+ localStorage.setItem('IDAS_AuthJwtCallbackPath', authPath || '');
55
55
  const authEndpoint = (new URL(window.location.href).origin) + authPath;
56
56
  let authUrlCallback = `${authEndpoint}?r=%target%&t=%jwt%&m=%mandant%`;
57
57
  authUrlCallback = authUrlCallback.replace('%target%', encodeURIComponent(window.location.href));
package/api/RESTClient.js CHANGED
@@ -86,7 +86,7 @@ export class RESTClient {
86
86
 
87
87
  updateJwtToken(jwt) {
88
88
  let decoded = jwt_decode(jwt);
89
- let refreshToken = decoded['refreshToken'];
89
+ let refreshToken = decoded['refreshToken'] || '';
90
90
  localStorage.setItem('IDAS_AuthJwtRefreshToken', refreshToken);
91
91
  authJwtRefreshToken = refreshToken;
92
92
  this.token = jwt;
package/index.js CHANGED
@@ -12,7 +12,7 @@ export {
12
12
  AddButton, RemoveButton, SaveButton,
13
13
  }
14
14
 
15
- import { IDAS } from './api/IDAS';
15
+ import { IDASFactory } from './api/IDAS';
16
16
  import { RESTClient } from './api/RESTClient';
17
17
 
18
- export { IDAS, RESTClient };
18
+ export { IDASFactory, RESTClient };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gandalan/weblibs",
3
- "version": "1.0.0",
3
+ "version": "1.0.2",
4
4
  "description": "WebLibs for Gandalan JS/TS/Svelte projects",
5
5
  "author": "Philipp Reif",
6
6
  "license": "ISC",