@gloww/gloww 20.0.0-beta.46 → 20.0.0-beta.47

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.
@@ -2528,17 +2528,22 @@ class UserMenuComponent {
2528
2528
  this.loginpage = '';
2529
2529
  this.showMenuUser = false;
2530
2530
  this.connected = false;
2531
- const person = this.authenticationService.currentUserValue;
2532
- if (person && person.UserInfo) {
2533
- this.connected = true;
2534
- if (person.UserInfo.Picture) {
2535
- this.imageUser = '/' + authenticationService.environment + '/' + person.UserInfo.Picture;
2536
- }
2537
- }
2531
+ this.setCurrentUser(this.authenticationService.currentUserValue);
2532
+ this.currentUserSubscription = this.authenticationService.currentUser?.subscribe(person => this.setCurrentUser(person));
2538
2533
  this.authenticationService.getOAuthProviders().subscribe(oap => this.oAuthProviders = oap);
2539
2534
  }
2540
2535
  ngOnInit() {
2541
2536
  }
2537
+ ngOnDestroy() {
2538
+ this.currentUserSubscription?.unsubscribe();
2539
+ }
2540
+ setCurrentUser(person) {
2541
+ this.connected = !!person;
2542
+ this.imageUser = null;
2543
+ if (person?.UserInfo?.Picture) {
2544
+ this.imageUser = '/' + this.authenticationService.environment + '/' + person.UserInfo.Picture;
2545
+ }
2546
+ }
2542
2547
  Logout() {
2543
2548
  this.showMenuUser = false;
2544
2549
  this.authenticationService.logout();