@lenne.tech/ng-base 14.28.1 → 14.29.1

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.
@@ -1010,8 +1010,13 @@ class AuthService {
1010
1010
  // Subjects
1011
1011
  this._currentUser = new BehaviorSubject(null);
1012
1012
  this._token = new BehaviorSubject(null);
1013
- this.token = this.storageService.load('token');
1014
- this.currentUser = this.storageService.load('currentUser');
1013
+ this.loadFromStorage();
1014
+ }
1015
+ loadFromStorage() {
1016
+ if (localStorage) {
1017
+ this.token = this.storageService.load('token');
1018
+ this.currentUser = this.storageService.load('currentUser');
1019
+ }
1015
1020
  }
1016
1021
  /**
1017
1022
  * Logout
@@ -1052,6 +1057,9 @@ class AuthService {
1052
1057
  this.wsService.reconnect();
1053
1058
  }
1054
1059
  get tokenObservable() {
1060
+ if (!this._token.value) {
1061
+ this.loadFromStorage();
1062
+ }
1055
1063
  return this._token.asObservable();
1056
1064
  }
1057
1065
  }