@gandalan/weblibs 1.0.18 → 1.0.20

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.
Files changed (2) hide show
  1. package/api/IDAS.js +5 -4
  2. package/package.json +1 -1
package/api/IDAS.js CHANGED
@@ -1,5 +1,6 @@
1
1
  import { jwtTokenInvalid } from "./authUtils";
2
2
  import { RESTClient } from "./RESTClient";
3
+ import jwt_decode from 'jwt-decode';
3
4
 
4
5
  export function IDASFactory(settings = {
5
6
  appToken : localStorage.getItem("IDAS_AppToken"),
@@ -39,14 +40,14 @@ class IDAS
39
40
  const token = this._self.settings.jwtToken;
40
41
  if (!token)
41
42
  return [];
42
- const decoded = jwt_decode(authJwtToken);
43
+ const decoded = jwt_decode(token);
43
44
  return decoded.rights;
44
45
  },
45
46
  getRoles() {
46
47
  const token = this._self.settings.jwtToken;
47
48
  if (!token)
48
49
  return [];
49
- const decoded = jwt_decode(authJwtToken);
50
+ const decoded = jwt_decode(token);
50
51
  return decoded.role;
51
52
  },
52
53
  hasRight(code)
@@ -60,8 +61,8 @@ class IDAS
60
61
  getUsername() {
61
62
  const token = this._self.settings.jwtToken;
62
63
  if (!token)
63
- return [];
64
- const decoded = jwt_decode(authJwtToken);
64
+ return undefined;
65
+ const decoded = jwt_decode(token);
65
66
  return decoded.id;
66
67
  }
67
68
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gandalan/weblibs",
3
- "version": "1.0.18",
3
+ "version": "1.0.20",
4
4
  "description": "WebLibs for Gandalan JS/TS/Svelte projects",
5
5
  "keywords": [
6
6
  "gandalan"