import { Component } from '@angular/core' ; import { ActivatedRoute , Router } from '@angular/router' ; import { AuthService } from '../../services/auth.service' ; @ Component ( { template : `` , } ) export class LogoutComponent { constructor ( public router , public route , public auth ) { this . route . url . subscribe ( segments => { this . logout ( segments && segments . length > 1 && segments [ 1 ] . toString ( ) === 'all' ) ; } ) ; } logout ( closeAllSessions = false ) { this . auth . logout ( closeAllSessions ) ; this . router . navigate ( [ '/login' ] ) ; } }