Headless CMS and Content Managment Hub
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

56 lines
1.2 KiB

/*
* Squidex Headless CMS
*
* @license
* Copyright (c) Sebastian Stehle. All rights reserved
*/
import * as Ng2 from '@angular/core';
import {
AuthService,
fadeAnimation,
ModalView
} from 'shared';
@Ng2.Component({
selector: 'sqx-profile-menu',
styles,
template,
animations: [
fadeAnimation
]
})
export class ProfileMenuComponent implements Ng2.OnInit, Ng2.OnDestroy {
private authenticationSubscription: any | null = null;
public modalMenu = new ModalView(false, true);
public profileDisplayName = '';
public profilePictureUrl = '';
constructor(
private readonly auth: AuthService
) {
}
public ngOnInit() {
this.authenticationSubscription =
this.auth.isAuthenticated.subscribe(() => {
const user = this.auth.user;
if (user) {
this.profilePictureUrl = user.pictureUrl;
this.profileDisplayName = user.displayName;
}
});
}
public ngOnDestroy() {
this.authenticationSubscription.unsubscribe();
}
public logout() {
this.auth.logoutRedirect();
}
}