@gandalan/weblibs 1.1.64 → 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 +2 -2
- package/api/fluentAuthBuilder.js +7 -2
- package/package.json +3 -3
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.
|
package/api/fluentAuthBuilder.js
CHANGED
|
@@ -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}
|
|
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
|
|
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.
|
|
3
|
+
"version": "1.1.66",
|
|
4
4
|
"description": "WebLibs for Gandalan JS/TS/Svelte projects",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"gandalan"
|
|
@@ -28,10 +28,10 @@
|
|
|
28
28
|
"validator": "^13.12.0"
|
|
29
29
|
},
|
|
30
30
|
"devDependencies": {
|
|
31
|
-
"@babel/eslint-parser": "^7.24.
|
|
31
|
+
"@babel/eslint-parser": "^7.24.8",
|
|
32
32
|
"chota": "^0.9.2",
|
|
33
33
|
"eslint": "^8.57.0",
|
|
34
|
-
"eslint-plugin-svelte": "^2.
|
|
34
|
+
"eslint-plugin-svelte": "^2.42.0",
|
|
35
35
|
"svelte": "^4.2.18",
|
|
36
36
|
"svelte-check": "^3.8.4",
|
|
37
37
|
"svelte-chota": "^1.8.6"
|