zek 14.2.69 → 14.2.70
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
|
@@ -1116,7 +1116,7 @@ class UrlHelper {
|
|
|
1116
1116
|
class AuthService {
|
|
1117
1117
|
constructor() {
|
|
1118
1118
|
this._isInitialized = false;
|
|
1119
|
-
this.
|
|
1119
|
+
this._oldValue = false;
|
|
1120
1120
|
this._user = null;
|
|
1121
1121
|
}
|
|
1122
1122
|
get user() {
|
|
@@ -1166,11 +1166,12 @@ class AuthService {
|
|
|
1166
1166
|
isAuthenticated() {
|
|
1167
1167
|
let expired = this.getExpired() || new Date(0); // if getExpired is null return min JS date
|
|
1168
1168
|
const newValue = new Date() < expired;
|
|
1169
|
-
if (this.
|
|
1170
|
-
this.
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1169
|
+
if (this._oldValue !== newValue) {
|
|
1170
|
+
this._oldValue = newValue;
|
|
1171
|
+
this.emitOnSignedIn();
|
|
1172
|
+
// if (this._onSignedInSubject) {
|
|
1173
|
+
// this._onSignedInSubject.next(newValue);
|
|
1174
|
+
// }
|
|
1174
1175
|
//if user is signed in and expired we need to logout (remove from localStorage)
|
|
1175
1176
|
if (!newValue) {
|
|
1176
1177
|
this.logout();
|
|
@@ -1179,6 +1180,11 @@ class AuthService {
|
|
|
1179
1180
|
}
|
|
1180
1181
|
return newValue;
|
|
1181
1182
|
}
|
|
1183
|
+
emitOnSignedIn() {
|
|
1184
|
+
if (this._onSignedInSubject) {
|
|
1185
|
+
this._onSignedInSubject.next(this._oldValue);
|
|
1186
|
+
}
|
|
1187
|
+
}
|
|
1182
1188
|
get onSignedIn() {
|
|
1183
1189
|
if (!this._onSignedInSubject) {
|
|
1184
1190
|
this._onSignedInSubject = new BehaviorSubject(false);
|