import { Injectable } from '@angular/core' ; import { AuthenticationService } from 'carey-auth' ; import { Observable } from 'rxjs' ; import { EmailService } from '../features/user/email/service/email.service' ; @ Injectable ( { providedIn : 'root' } ) export class LogoutService { private logoutListener$ : Observable < boolean > ; constructor ( private emailService , private authenticationService ) { this . logoutListener$ = authenticationService . authNotification$ ; this . logoutListener$ . subscribe ( ( statusChange ) => this . handleStatusChange ( statusChange ) ) ; } private handleStatusChange ( loginStatus ) { if ( ! loginStatus ) { this . emailService . clearObservables ( ) ; } } }