- choices = [];
- isLoggedIn: boolean;
-
- constructor(
- private authService: AuthService,
- private friendService: FriendService,
- private router: Router
- ) {
- this.isLoggedIn = this.authService.isLoggedIn();
-
- this.authService.loginChangedSource.subscribe(
- status => {
- if (status === AuthStatus.LoggedIn) {
- this.isLoggedIn = true;
- }
- }
- );
- }
-
- onSearch(search: Search) {
- if (search.value !== '') {
- const params = {
- field: search.field,
- search: search.value
- };
- this.router.navigate(['VideosList', params]);
- } else {
- this.router.navigate(['VideosList']);
- }
- }
-
- logout() {
- // this._authService.logout();
- }
-
- makeFriends() {
- this.friendService.makeFriends().subscribe(
- status => {
- if (status === 409) {
- alert('Already made friends!');
- } else {
- alert('Made friends!');
- }
- },
- error => alert(error)
- );
- }