Travel component
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
<img width="100%" src="/assets/img/logo.png" />
|
||||
</mat-grid-tile>
|
||||
<mat-grid-tile colspan="1" rowspan="2">
|
||||
<div *ngIf="name; then thenBlock; else elseBlock"></div>
|
||||
<div *ngIf="logged; then thenBlock; else elseBlock"></div>
|
||||
<ng-template #thenBlock>
|
||||
{{ name }}
|
||||
<button mat-raised-button class="btn btn-default" (click)="logout()">Logout</button>
|
||||
|
||||
@@ -8,19 +8,17 @@ import { authConfig } from '../auth.config';
|
||||
styleUrls: ['./header.component.css'],
|
||||
})
|
||||
export class HeaderComponent implements OnInit {
|
||||
constructor(private oauthService: OAuthService) {}
|
||||
constructor(private oauthService: OAuthService) { }
|
||||
|
||||
ngOnInit(): void {}
|
||||
ngOnInit(): void {
|
||||
this.oauthService.configure(authConfig);
|
||||
this.oauthService.loadDiscoveryDocumentAndTryLogin().then(success => {
|
||||
console.log('Autologin success=' + success + ' logged=' + String(this.logged));
|
||||
});
|
||||
}
|
||||
|
||||
async login(): Promise<void> {
|
||||
this.oauthService.configure(authConfig);
|
||||
await this.oauthService.loadDiscoveryDocument();
|
||||
if (
|
||||
!this.oauthService.hasValidIdToken() ||
|
||||
!this.oauthService.hasValidAccessToken()
|
||||
) {
|
||||
this.oauthService.initLoginFlow('some-state');
|
||||
}
|
||||
this.oauthService.loadDiscoveryDocumentAndLogin();
|
||||
}
|
||||
|
||||
logout(): void {
|
||||
|
||||
Reference in New Issue
Block a user