@stemy/ngx-utils 12.2.18 → 12.2.19
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/bundles/stemy-ngx-utils.umd.js +6 -3
- package/bundles/stemy-ngx-utils.umd.js.map +1 -1
- package/esm2015/ngx-utils/services/base-http.service.js +7 -4
- package/fesm2015/stemy-ngx-utils.js +6 -3
- package/fesm2015/stemy-ngx-utils.js.map +1 -1
- package/ngx-utils/services/base-http.service.d.ts +1 -0
- package/package.json +1 -1
- package/stemy-ngx-utils.metadata.json +1 -1
|
@@ -3211,8 +3211,8 @@
|
|
|
3211
3211
|
// If we use token auth
|
|
3212
3212
|
if (_this.client.renewTokenFunc && headers.has(authKey)) {
|
|
3213
3213
|
var currentTime = new Date().getTime();
|
|
3214
|
-
var userTokenTime = _this.
|
|
3215
|
-
// And the last request was a long
|
|
3214
|
+
var userTokenTime = _this.getUserTokenTime() || currentTime;
|
|
3215
|
+
// And the last request was a long-long time ago
|
|
3216
3216
|
if (currentTime - 600000 > userTokenTime) {
|
|
3217
3217
|
_this.client.renewTokenFunc();
|
|
3218
3218
|
}
|
|
@@ -3224,7 +3224,7 @@
|
|
|
3224
3224
|
}
|
|
3225
3225
|
var headers = options.headers;
|
|
3226
3226
|
var authKey = "Authorization";
|
|
3227
|
-
// If an authorization header exists and we still have an Unauthorized response prompt the user to log in again
|
|
3227
|
+
// If an authorization header exists, and we still have an Unauthorized response prompt the user to log in again
|
|
3228
3228
|
if (headers.has(authKey) && response.status == 401) {
|
|
3229
3229
|
var pushed = _this.pushFailedRequest(url, options, function () {
|
|
3230
3230
|
options.headers = _this.makeHeaders(options.originalHeaders);
|
|
@@ -3239,6 +3239,9 @@
|
|
|
3239
3239
|
});
|
|
3240
3240
|
});
|
|
3241
3241
|
};
|
|
3242
|
+
BaseHttpService.prototype.getUserTokenTime = function () {
|
|
3243
|
+
return this.storage.get("userTokenTime");
|
|
3244
|
+
};
|
|
3242
3245
|
BaseHttpService.prototype.pushFailedRequest = function (url, options, req) {
|
|
3243
3246
|
if (url.indexOf("tokens") >= 0)
|
|
3244
3247
|
return false;
|