2018-06-13 18:34:10 +02:00
|
|
|
import { Component, OnInit } from '@angular/core';
|
2018-06-19 16:55:50 +02:00
|
|
|
import { Router } from '@angular/router';
|
2018-06-25 17:03:52 +02:00
|
|
|
import { BreakpointObserver, Breakpoints, BreakpointState } from '@angular/cdk/layout';
|
2018-06-19 16:55:50 +02:00
|
|
|
|
|
|
|
import { AuthService } from 'app/core/services/auth.service';
|
2018-06-13 18:34:10 +02:00
|
|
|
|
|
|
|
@Component({
|
2018-06-16 18:05:46 +02:00
|
|
|
selector: 'app-site',
|
|
|
|
templateUrl: './site.component.html',
|
|
|
|
styleUrls: ['./site.component.css']
|
2018-06-13 18:34:10 +02:00
|
|
|
})
|
|
|
|
export class SiteComponent implements OnInit {
|
2018-06-25 17:03:52 +02:00
|
|
|
isMobile = false;
|
2018-06-13 18:34:10 +02:00
|
|
|
|
2018-06-25 17:03:52 +02:00
|
|
|
constructor(
|
|
|
|
private authService: AuthService,
|
|
|
|
private router: Router,
|
|
|
|
private breakpointObserver: BreakpointObserver
|
|
|
|
) {}
|
|
|
|
|
|
|
|
ngOnInit() {
|
|
|
|
this.breakpointObserver
|
|
|
|
.observe([Breakpoints.Small, Breakpoints.HandsetPortrait])
|
|
|
|
.subscribe((state: BreakpointState) => {
|
|
|
|
if (state.matches) {
|
|
|
|
this.isMobile = true;
|
|
|
|
} else {
|
|
|
|
this.isMobile = false;
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
2018-06-13 18:34:10 +02:00
|
|
|
|
2018-06-19 16:55:50 +02:00
|
|
|
logOutButton() {
|
|
|
|
console.log('logout');
|
|
|
|
this.authService.logout().subscribe();
|
|
|
|
this.router.navigate(['/login']);
|
|
|
|
}
|
2018-06-13 18:34:10 +02:00
|
|
|
}
|