mirror of
https://github.com/mempool/mempool.git
synced 2025-03-03 17:47:01 +01:00
[auth] fix blinking profile picture
This commit is contained in:
parent
8ba4a7b421
commit
7fd8790750
3 changed files with 7 additions and 10 deletions
|
@ -29,7 +29,6 @@ export class MasterPageComponent implements OnInit {
|
|||
networkPaths: { [network: string]: string };
|
||||
networkPaths$: Observable<Record<string, string>>;
|
||||
footerVisible = true;
|
||||
userAuth: any | undefined;
|
||||
user: any = undefined;
|
||||
servicesEnabled = false;
|
||||
menuOpen = false;
|
||||
|
@ -94,7 +93,7 @@ export class MasterPageComponent implements OnInit {
|
|||
}
|
||||
|
||||
refreshAuth(): void {
|
||||
this.apiService.getUserInfo$().subscribe(user => this.user = user);
|
||||
this.user = this.storageService.getAuth()?.user ?? null;
|
||||
}
|
||||
|
||||
hamburgerClick(event): void {
|
||||
|
|
|
@ -30,6 +30,11 @@ export class MenuComponent implements OnInit {
|
|||
|
||||
ngOnInit(): void {
|
||||
this.userAuth = this.storageService.getAuth();
|
||||
if (this.userAuth && this.userAuth.user && !this.userAuth.user.imageMd5) {
|
||||
this.logout();
|
||||
return;
|
||||
}
|
||||
|
||||
if (this.stateService.env.GIT_COMMIT_HASH_MEMPOOL_SPACE) {
|
||||
this.userMenuGroups$ = this.apiService.getUserMenuGroups$();
|
||||
}
|
||||
|
|
|
@ -28,7 +28,6 @@ export class GlobalFooterComponent implements OnInit {
|
|||
networkPaths: { [network: string]: string };
|
||||
currentNetwork = '';
|
||||
loggedIn = false;
|
||||
username = null;
|
||||
urlSubscription: Subscription;
|
||||
isServicesPage = false;
|
||||
|
||||
|
@ -64,13 +63,7 @@ export class GlobalFooterComponent implements OnInit {
|
|||
});
|
||||
|
||||
this.urlSubscription = this.route.url.subscribe((url) => {
|
||||
this.loggedIn = JSON.parse(this.storageService.getValue('auth')) !== null;
|
||||
const auth = JSON.parse(this.storageService.getValue('auth'));
|
||||
if (auth?.user?.username) {
|
||||
this.username = auth.user.username;
|
||||
} else {
|
||||
this.username = null;
|
||||
}
|
||||
this.loggedIn = this.storageService.getAuth() !== null;
|
||||
this.cd.markForCheck();
|
||||
})
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue