import { Component , OnDestroy , OnInit } from '@angular/core' ; import { Breakpoints , BreakpointObserver , BreakpointState } from '@angular/cdk/layout' ; import { Subscription } from 'rxjs' ; import { AuthenticationService } from '@core/services/index.service' ; import { LoginAuditModel , ProfileModel } from '@shared/models/index.model' ; /**
 * Profile component
 */ @ Component ( { selector : 'dashboard-profile' , templateUrl : './profile.component.html' , styleUrls : [ './profile.component.scss' ] , } ) export class ProfileComponent implements OnInit , OnDestroy { private loginsSubscription : Subscription ; public profile : ProfileModel ; public logins : LoginAuditModel [ ] = [ ] ; public isSmallScreen : boolean ; displayedColumns : string [ ] = [ 'title' , 'description' ] ; param authService param breakpointObserver constructor ( public authService , private breakpointObserver ) { } /**
     * Life cycle init method
     */ ngOnInit ( ) { this . profile = this . authService . profile ; this . loginsSubscription = this . authService . getLogins ( ) . subscribe ( ( logins ) => this . logins = logins ) ; this . breakpointObserver . observe ( [ Breakpoints . XSmall ] ) . subscribe ( ( state ) => { if ( state . matches ) { this . displayedColumns = [ 'title' ] ; this . isSmallScreen = true ; } else { this . displayedColumns = [ 'title' , 'description' ] ; this . isSmallScreen = false ; } } ) ; } /**
     * Life cycle destroy method
     */ ngOnDestroy ( ) { this . loginsSubscription . unsubscribe ( ) ; } }