import { Component, OnInit, Input } from '@angular/core'; import { AuthenticationService } from '../../services/authentication.service'; import { AuthService } from '../../services/auth.service'; import { Router } from '@angular/router'; @Component({ selector: 'app-logout-tool', templateUrl: './logout-tool.component.html', styleUrls: ['./logout-tool.component.css'], providers: [AuthenticationService] }) export class LogoutToolComponent implements OnInit { @Input() LogoutRoute: string = '/'; constructor(private authentication: AuthenticationService, private auth: AuthService, private _router: Router) { } ngOnInit() { } logout() { this.authentication.logout() .then(() => { return this.auth.logoutSuccess(); }) .then(() => { this._router.navigate([this.LogoutRoute]); }) .catch((err) => { console.log(err); }); } }