@gandalan/weblibs 1.1.65 → 1.1.66

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/api/fluentApi.js CHANGED
@@ -104,8 +104,8 @@ export function isTokenValid(token)
104
104
  * @property {function(string) : FluentApi} useRefreshToken - Sets the refresh token and returns the FluentApi object.
105
105
  * @property {function() : FluentApi} useGlobalAuth - Uses global authentication tokens and returns the FluentApi object.
106
106
  * @property {function(string) : object|Array<any>} get - Async function to perform GET requests.
107
- * @property {function(string, object) : object|Array<any>} put - Async function to perform PUT requests with a payload.
108
- * @property {function(string, object) : object|Array<any>} post - Async function to perform POST requests with a payload.
107
+ * @property {function(string, object|null) : object|Array<any>} put - Async function to perform PUT requests with a payload.
108
+ * @property {function(string, object|null) : object|Array<any>} post - Async function to perform POST requests with a payload.
109
109
  * @property {function(string) : object|Array<any>} delete - Async function to perform DELETE requests.
110
110
  * @property {Function} ensureAuthenticated - Ensures the user is authenticated before making a request.
111
111
  * @property {Function} ensureBaseUrlIsSet - Ensures the base URL is set before making a request.
@@ -132,7 +132,7 @@ export function authBuilder() {
132
132
  */
133
133
  async tryRefreshToken(refreshToken = "") {
134
134
  const payload = { "Token": refreshToken };
135
- const res = await fetch(`${this.authUrl}/LoginJwt/Refresh`,
135
+ const res = await fetch(`${this.authUrl}LoginJwt/Refresh`,
136
136
  {
137
137
  method: "PUT",
138
138
  body: JSON.stringify(payload),
@@ -165,8 +165,13 @@ export function authBuilder() {
165
165
  this.redirectToLogin();
166
166
  }
167
167
 
168
+ let userInfo = {};
169
+ if (this.token)
170
+ {
171
+ userInfo = jwtDecode(this.token);
172
+ }
168
173
  // eslint-disable-next-line no-undef
169
- globalThis.idasTokens = { token: this.token, refreshToken: this.refreshToken, appToken: this.appToken, userInfo: jwtDecode(this.token) };
174
+ globalThis.idasTokens = { token: this.token, refreshToken: this.refreshToken, appToken: this.appToken, userInfo };
170
175
  },
171
176
 
172
177
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gandalan/weblibs",
3
- "version": "1.1.65",
3
+ "version": "1.1.66",
4
4
  "description": "WebLibs for Gandalan JS/TS/Svelte projects",
5
5
  "keywords": [
6
6
  "gandalan"