Router redirect to login instead of window reload
This commit is contained in:
parent
49e2532434
commit
eee8f8e949
1 changed files with 9 additions and 10 deletions
|
@ -9,12 +9,12 @@ import { Router } from '@angular/router';
|
||||||
})
|
})
|
||||||
export class FullLayoutComponent implements OnInit {
|
export class FullLayoutComponent implements OnInit {
|
||||||
displayName: any;
|
displayName: any;
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
private api: ApiService,
|
private api: ApiService,
|
||||||
private router: Router,
|
private router: Router,
|
||||||
) {}
|
) {}
|
||||||
|
|
||||||
public disabled = false;
|
public disabled = false;
|
||||||
public status: {isopen: boolean} = {isopen: false};
|
public status: {isopen: boolean} = {isopen: false};
|
||||||
|
|
||||||
|
@ -32,17 +32,16 @@ export class FullLayoutComponent implements OnInit {
|
||||||
ngOnInit(): void {
|
ngOnInit(): void {
|
||||||
this.displayName = localStorage.getItem('displayname') || 'User';
|
this.displayName = localStorage.getItem('displayname') || 'User';
|
||||||
}
|
}
|
||||||
|
|
||||||
userLogout() {
|
userLogout() {
|
||||||
console.log('logout clicked');
|
console.log('logout clicked');
|
||||||
this.api
|
this.api
|
||||||
.logout()
|
.logout()
|
||||||
.subscribe(
|
.subscribe(
|
||||||
result => {
|
result => {
|
||||||
console.log('Logged out!');
|
console.log('Logged out!');
|
||||||
// TODO Reload? srsly?
|
this.router.navigate(['/login']);
|
||||||
window.location.reload();
|
}
|
||||||
}
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Reference in a new issue