aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/app/app.component.ts
diff options
context:
space:
mode:
authorChocobozzz <florian.bigard@gmail.com>2016-06-03 22:08:03 +0200
committerChocobozzz <florian.bigard@gmail.com>2016-06-03 22:08:03 +0200
commit4a6995be18b15de1834a39c8921a0e4109671bb6 (patch)
treeb659661cea33687fcc6bd8fc2251cb7a15ab9f9d /client/app/app.component.ts
parent468892541175f9662f8b1b977e819dc1a496f282 (diff)
downloadPeerTube-4a6995be18b15de1834a39c8921a0e4109671bb6.tar.gz
PeerTube-4a6995be18b15de1834a39c8921a0e4109671bb6.tar.zst
PeerTube-4a6995be18b15de1834a39c8921a0e4109671bb6.zip
First draft to use webpack instead of systemjs
Diffstat (limited to 'client/app/app.component.ts')
-rw-r--r--client/app/app.component.ts109
1 files changed, 0 insertions, 109 deletions
diff --git a/client/app/app.component.ts b/client/app/app.component.ts
deleted file mode 100644
index 94924a47a..000000000
--- a/client/app/app.component.ts
+++ /dev/null
@@ -1,109 +0,0 @@
1import { Component } from '@angular/core';
2import { HTTP_PROVIDERS } from '@angular/http';
3import { RouteConfig, Router, ROUTER_DIRECTIVES, ROUTER_PROVIDERS } from '@angular/router-deprecated';
4
5import { FriendService } from './friends/index';
6import { LoginComponent } from './login/index';
7import {
8 AuthService,
9 AuthStatus,
10 Search,
11 SearchComponent
12} from './shared/index';
13import {
14 VideoAddComponent,
15 VideoListComponent,
16 VideoWatchComponent,
17 VideoService
18} from './videos/index';
19
20@RouteConfig([
21 {
22 path: '/users/login',
23 name: 'UserLogin',
24 component: LoginComponent
25 },
26 {
27 path: '/videos/list',
28 name: 'VideosList',
29 component: VideoListComponent,
30 useAsDefault: true
31 },
32 {
33 path: '/videos/watch/:id',
34 name: 'VideosWatch',
35 component: VideoWatchComponent
36 },
37 {
38 path: '/videos/add',
39 name: 'VideosAdd',
40 component: VideoAddComponent
41 }
42])
43
44@Component({
45 selector: 'my-app',
46 templateUrl: 'client/app/app.component.html',
47 styleUrls: [ 'client/app/app.component.css' ],
48 directives: [ ROUTER_DIRECTIVES, SearchComponent ],
49 providers: [ AuthService, FriendService, HTTP_PROVIDERS, ROUTER_PROVIDERS, VideoService ]
50})
51
52export class AppComponent {
53 choices = [];
54 isLoggedIn: boolean;
55
56 constructor(
57 private authService: AuthService,
58 private friendService: FriendService,
59 private router: Router
60 ) {
61 this.isLoggedIn = this.authService.isLoggedIn();
62
63 this.authService.loginChangedSource.subscribe(
64 status => {
65 if (status === AuthStatus.LoggedIn) {
66 this.isLoggedIn = true;
67 }
68 }
69 );
70 }
71
72 onSearch(search: Search) {
73 if (search.value !== '') {
74 const params = {
75 field: search.field,
76 search: search.value
77 };
78 this.router.navigate(['VideosList', params]);
79 } else {
80 this.router.navigate(['VideosList']);
81 }
82 }
83
84 logout() {
85 // this._authService.logout();
86 }
87
88 makeFriends() {
89 this.friendService.makeFriends().subscribe(
90 status => {
91 if (status === 409) {
92 alert('Already made friends!');
93 } else {
94 alert('Made friends!');
95 }
96 },
97 error => alert(error)
98 );
99 }
100
101 quitFriends() {
102 this.friendService.quitFriends().subscribe(
103 status => {
104 alert('Quit friends!');
105 },
106 error => alert(error)
107 );
108 }
109}