datasurvey/src/main/webapp/app/layouts/footer/footer.component.ts

33 lines
899 B
TypeScript
Raw Normal View History

2021-07-03 21:48:27 +00:00
import { Component } from '@angular/core';
import { Account } from '../../core/auth/account.model';
import { takeUntil } from 'rxjs/operators';
import { AccountService } from '../../core/auth/account.service';
import { Subject } from 'rxjs';
2021-07-03 21:48:27 +00:00
@Component({
selector: 'jhi-footer',
templateUrl: './footer.component.html',
styleUrls: ['./footer.component.scss'],
2021-07-03 21:48:27 +00:00
})
export class FooterComponent {
account: Account | null = null;
notAccount: boolean = true;
private readonly destroy$ = new Subject<void>();
constructor(protected accountService: AccountService) {}
ngOnInit(): void {
this.accountService
.getAuthenticationState()
.pipe(takeUntil(this.destroy$))
.subscribe(account => {
if (account !== null) {
this.account = account;
this.notAccount = false;
} else {
this.notAccount = true;
}
});
}
}