From eee8f8e949013ef75cf1418be588782426e95540 Mon Sep 17 00:00:00 2001 From: Tom Bloor Date: Wed, 16 Aug 2017 15:58:31 +0100 Subject: [PATCH] Router redirect to login instead of window reload --- src/app/layouts/full-layout.component.ts | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/src/app/layouts/full-layout.component.ts b/src/app/layouts/full-layout.component.ts index 29405f9..dd7ca12 100644 --- a/src/app/layouts/full-layout.component.ts +++ b/src/app/layouts/full-layout.component.ts @@ -9,12 +9,12 @@ import { Router } from '@angular/router'; }) export class FullLayoutComponent implements OnInit { displayName: any; - + constructor( private api: ApiService, private router: Router, ) {} - + public disabled = false; public status: {isopen: boolean} = {isopen: false}; @@ -32,17 +32,16 @@ export class FullLayoutComponent implements OnInit { ngOnInit(): void { this.displayName = localStorage.getItem('displayname') || 'User'; } - + userLogout() { - console.log('logout clicked'); - this.api + console.log('logout clicked'); + this.api .logout() .subscribe( - result => { - console.log('Logged out!'); - // TODO Reload? srsly? - window.location.reload(); - } + result => { + console.log('Logged out!'); + this.router.navigate(['/login']); + } ); } }