@osimatic/helpers-js 1.0.101 → 1.0.102

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/http_client.js +6 -5
  2. package/package.json +1 -1
package/http_client.js CHANGED
@@ -14,6 +14,10 @@ class HTTPClient {
14
14
  HTTPClient.onInvalidTokenCallback = callback;
15
15
  }
16
16
 
17
+ static setOnInvalidRefreshTokenRedirectUrl(url) {
18
+ HTTPClient.onInvalidRefreshTokenRedirectUrl = url;
19
+ }
20
+
17
21
  static getHeaders(asObject) {
18
22
  HTTPClient.setAuthorizationToken(JwtSession.getToken());
19
23
 
@@ -161,10 +165,7 @@ class HTTPClient {
161
165
  return;
162
166
  }
163
167
 
164
- JwtSession.logout();
165
- if (typeof HTTPClient.onInvalidTokenRedirectUrl != 'undefined') {
166
- window.location.href = HTTPClient.onInvalidTokenRedirectUrl;
167
- }
168
+ JwtSession.logout(HTTPClient.onInvalidTokenRedirectUrl);
168
169
  }
169
170
 
170
171
  static async request(method, url, data, successCallback, errorCallback, formErrorCallback) {
@@ -337,7 +338,7 @@ class HTTPClient {
337
338
  onRefreshTokenComplete();
338
339
  },
339
340
  () => {
340
- JwtSession.logout();
341
+ JwtSession.logout(HTTPClient.onInvalidRefreshTokenRedirectUrl);
341
342
  errorCallback();
342
343
  }
343
344
  );
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@osimatic/helpers-js",
3
- "version": "1.0.101",
3
+ "version": "1.0.102",
4
4
  "main": "main.js",
5
5
  "scripts": {
6
6
  "test": "echo \"Error: no test specified\" && exit 1"