aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/angular/videos/components/list/videos-list.component.ts
diff options
context:
space:
mode:
Diffstat (limited to 'client/angular/videos/components/list/videos-list.component.ts')
-rw-r--r--client/angular/videos/components/list/videos-list.component.ts10
1 files changed, 9 insertions, 1 deletions
diff --git a/client/angular/videos/components/list/videos-list.component.ts b/client/angular/videos/components/list/videos-list.component.ts
index ae58f4d7e..b9b440d40 100644
--- a/client/angular/videos/components/list/videos-list.component.ts
+++ b/client/angular/videos/components/list/videos-list.component.ts
@@ -1,6 +1,8 @@
1import { Component, OnInit } from 'angular2/core'; 1import { Component, OnInit } from 'angular2/core';
2import { ROUTER_DIRECTIVES, RouteParams } from 'angular2/router'; 2import { ROUTER_DIRECTIVES, RouteParams } from 'angular2/router';
3 3
4import { AuthService } from '../../../users/services/auth.service';
5import { User } from '../../../users/models/user';
4import { VideosService } from '../../services/videos.service'; 6import { VideosService } from '../../services/videos.service';
5import { Video } from '../../models/video'; 7import { Video } from '../../models/video';
6 8
@@ -12,11 +14,13 @@ import { Video } from '../../models/video';
12}) 14})
13 15
14export class VideosListComponent implements OnInit { 16export class VideosListComponent implements OnInit {
17 user: User = null;
15 videos: Video[]; 18 videos: Video[];
16 19
17 private search: string; 20 private search: string;
18 21
19 constructor( 22 constructor(
23 private _authService: AuthService,
20 private _videosService: VideosService, 24 private _videosService: VideosService,
21 routeParams: RouteParams 25 routeParams: RouteParams
22 ) { 26 ) {
@@ -24,13 +28,17 @@ export class VideosListComponent implements OnInit {
24 } 28 }
25 29
26 ngOnInit() { 30 ngOnInit() {
31 if (this._authService.isLoggedIn()) {
32 this.user = User.load();
33 }
34
27 this.getVideos(); 35 this.getVideos();
28 } 36 }
29 37
30 getVideos() { 38 getVideos() {
31 let observable = null; 39 let observable = null;
32 40
33 if (this.search !== null) { 41 if (this.search !== null) {""
34 observable = this._videosService.searchVideos(this.search); 42 observable = this._videosService.searchVideos(this.search);
35 } else { 43 } else {
36 observable = this._videosService.getVideos(); 44 observable = this._videosService.getVideos();