@stemy/ngx-utils 12.2.17 → 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 +15 -9
- package/bundles/stemy-ngx-utils.umd.js.map +1 -1
- package/esm2015/ngx-utils/services/base-http.service.js +7 -4
- package/esm2015/ngx-utils/services/universal.service.js +10 -7
- package/fesm2015/stemy-ngx-utils.js +15 -9
- package/fesm2015/stemy-ngx-utils.js.map +1 -1
- package/ngx-utils/services/base-http.service.d.ts +1 -0
- package/ngx-utils/services/universal.service.d.ts +3 -2
- package/package.json +1 -1
- package/stemy-ngx-utils.metadata.json +1 -1
|
@@ -1888,7 +1888,7 @@
|
|
|
1888
1888
|
});
|
|
1889
1889
|
Object.defineProperty(UniversalService.prototype, "browserName", {
|
|
1890
1890
|
get: function () {
|
|
1891
|
-
return this.dds.browser;
|
|
1891
|
+
return (this.dds.browser || "").toLowerCase();
|
|
1892
1892
|
},
|
|
1893
1893
|
enumerable: false,
|
|
1894
1894
|
configurable: true
|
|
@@ -1902,35 +1902,35 @@
|
|
|
1902
1902
|
});
|
|
1903
1903
|
Object.defineProperty(UniversalService.prototype, "isExplorer", {
|
|
1904
1904
|
get: function () {
|
|
1905
|
-
return this.
|
|
1905
|
+
return this.checkBrowser("ie");
|
|
1906
1906
|
},
|
|
1907
1907
|
enumerable: false,
|
|
1908
1908
|
configurable: true
|
|
1909
1909
|
});
|
|
1910
1910
|
Object.defineProperty(UniversalService.prototype, "isEdge", {
|
|
1911
1911
|
get: function () {
|
|
1912
|
-
return this.
|
|
1912
|
+
return this.checkBrowser("edge");
|
|
1913
1913
|
},
|
|
1914
1914
|
enumerable: false,
|
|
1915
1915
|
configurable: true
|
|
1916
1916
|
});
|
|
1917
1917
|
Object.defineProperty(UniversalService.prototype, "isChrome", {
|
|
1918
1918
|
get: function () {
|
|
1919
|
-
return this.
|
|
1919
|
+
return this.checkBrowser("chrome");
|
|
1920
1920
|
},
|
|
1921
1921
|
enumerable: false,
|
|
1922
1922
|
configurable: true
|
|
1923
1923
|
});
|
|
1924
1924
|
Object.defineProperty(UniversalService.prototype, "isFirefox", {
|
|
1925
1925
|
get: function () {
|
|
1926
|
-
return this.
|
|
1926
|
+
return this.checkBrowser("firefox");
|
|
1927
1927
|
},
|
|
1928
1928
|
enumerable: false,
|
|
1929
1929
|
configurable: true
|
|
1930
1930
|
});
|
|
1931
1931
|
Object.defineProperty(UniversalService.prototype, "isSafari", {
|
|
1932
1932
|
get: function () {
|
|
1933
|
-
return this.
|
|
1933
|
+
return this.checkBrowser("safari");
|
|
1934
1934
|
},
|
|
1935
1935
|
enumerable: false,
|
|
1936
1936
|
configurable: true
|
|
@@ -1963,6 +1963,9 @@
|
|
|
1963
1963
|
enumerable: false,
|
|
1964
1964
|
configurable: true
|
|
1965
1965
|
});
|
|
1966
|
+
UniversalService.prototype.checkBrowser = function (name) {
|
|
1967
|
+
return this.browserName.includes(name) || false;
|
|
1968
|
+
};
|
|
1966
1969
|
return UniversalService;
|
|
1967
1970
|
}());
|
|
1968
1971
|
UniversalService.decorators = [
|
|
@@ -3208,8 +3211,8 @@
|
|
|
3208
3211
|
// If we use token auth
|
|
3209
3212
|
if (_this.client.renewTokenFunc && headers.has(authKey)) {
|
|
3210
3213
|
var currentTime = new Date().getTime();
|
|
3211
|
-
var userTokenTime = _this.
|
|
3212
|
-
// And the last request was a long
|
|
3214
|
+
var userTokenTime = _this.getUserTokenTime() || currentTime;
|
|
3215
|
+
// And the last request was a long-long time ago
|
|
3213
3216
|
if (currentTime - 600000 > userTokenTime) {
|
|
3214
3217
|
_this.client.renewTokenFunc();
|
|
3215
3218
|
}
|
|
@@ -3221,7 +3224,7 @@
|
|
|
3221
3224
|
}
|
|
3222
3225
|
var headers = options.headers;
|
|
3223
3226
|
var authKey = "Authorization";
|
|
3224
|
-
// 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
|
|
3225
3228
|
if (headers.has(authKey) && response.status == 401) {
|
|
3226
3229
|
var pushed = _this.pushFailedRequest(url, options, function () {
|
|
3227
3230
|
options.headers = _this.makeHeaders(options.originalHeaders);
|
|
@@ -3236,6 +3239,9 @@
|
|
|
3236
3239
|
});
|
|
3237
3240
|
});
|
|
3238
3241
|
};
|
|
3242
|
+
BaseHttpService.prototype.getUserTokenTime = function () {
|
|
3243
|
+
return this.storage.get("userTokenTime");
|
|
3244
|
+
};
|
|
3239
3245
|
BaseHttpService.prototype.pushFailedRequest = function (url, options, req) {
|
|
3240
3246
|
if (url.indexOf("tokens") >= 0)
|
|
3241
3247
|
return false;
|