zek 14.2.66 → 14.2.68

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/fesm2020/zek.mjs CHANGED
@@ -1141,18 +1141,26 @@ class AuthService {
1141
1141
  let user = this._user;
1142
1142
  if (user && user.refreshTokenTime) {
1143
1143
  let timeout = user.refreshTokenTime.getTime() - Date.now(); // - (60 * 1000);
1144
- if (timeout < 0)
1145
- timeout = 0;
1146
- this._refreshTokenTimeout = setTimeout(() => {
1147
- if (this._onRefreshTokenSubject) {
1148
- this._onRefreshTokenSubject.next();
1149
- }
1150
- }, timeout);
1144
+ if (timeout < 0) {
1145
+ this._emitRefreshToken();
1146
+ }
1147
+ const minRefreshTime = 60000; //1 min;
1148
+ if (timeout < minRefreshTime) {
1149
+ timeout = minRefreshTime;
1150
+ }
1151
+ console.log('setInterval timeout', timeout);
1152
+ this._timerId = setInterval(this._emitRefreshToken, timeout);
1151
1153
  }
1152
1154
  }
1153
1155
  _stopRefreshTokenTimer() {
1154
- if (typeof this._refreshTokenTimeout === 'number') {
1155
- clearTimeout(this._refreshTokenTimeout);
1156
+ if (typeof this._timerId === 'number') {
1157
+ console.log('clearInterval timerId', this._timerId);
1158
+ clearInterval(this._timerId);
1159
+ }
1160
+ }
1161
+ _emitRefreshToken() {
1162
+ if (this._onRefreshTokenSubject) {
1163
+ this._onRefreshTokenSubject.next();
1156
1164
  }
1157
1165
  }
1158
1166
  isAuthenticated() {