[menu] handle logout without reload, show signin in sidebar when not logged in

This commit is contained in:
nymkappa
2023-08-18 18:33:09 +02:00
parent 0c1221dc07
commit c4f2f4ca66
5 changed files with 35 additions and 17 deletions

View File

@@ -1,4 +1,4 @@
<app-menu *ngIf="servicesEnabled"></app-menu>
<app-menu *ngIf="servicesEnabled" (loggedOut)="onLoggedOut()"></app-menu>
<ng-container *ngIf="{ val: network$ | async } as network">
<header *ngIf="headerVisible" style="position: fixed; width: 100%; z-index: 100;">

View File

@@ -59,7 +59,7 @@ export class MasterPageComponent implements OnInit {
});
this.servicesEnabled = this.officialMempoolSpace && this.stateService.env.ACCELERATOR === true && this.stateService.network === '';
this.userAuth = JSON.parse(localStorage.getItem('auth') || '') ?? null;
this.refreshAuth();
}
collapse(): void {
@@ -74,6 +74,14 @@ export class MasterPageComponent implements OnInit {
this.stateService.resetScroll$.next(true);
}
onLoggedOut() {
this.refreshAuth();
}
refreshAuth(): void {
this.userAuth = JSON.parse(localStorage.getItem('auth') || '') ?? null;
}
hamburgerClick(): void {
if (this.menuComponent) {
this.menuComponent.hambugerClick();