diff options
author | Chocobozzz <florian.bigard@gmail.com> | 2016-04-08 20:58:07 +0200 |
---|---|---|
committer | Chocobozzz <florian.bigard@gmail.com> | 2016-04-08 21:03:47 +0200 |
commit | 44124980c55d5a5ec7dfb8e71bf14d10f0fe975d (patch) | |
tree | 795191ff37d862a4bcf9cbc57cdb60b909b038d1 /client/angular | |
parent | 0dde91ff15ec3cb73d39da50b388e5e525160cb4 (diff) | |
download | PeerTube-44124980c55d5a5ec7dfb8e71bf14d10f0fe975d.tar.gz PeerTube-44124980c55d5a5ec7dfb8e71bf14d10f0fe975d.tar.zst PeerTube-44124980c55d5a5ec7dfb8e71bf14d10f0fe975d.zip |
Add typescript (and angular2) linter
Diffstat (limited to 'client/angular')
6 files changed, 18 insertions, 19 deletions
diff --git a/client/angular/app/app.component.ts b/client/angular/app/app.component.ts index 1648b8870..68c9ba009 100644 --- a/client/angular/app/app.component.ts +++ b/client/angular/app/app.component.ts | |||
@@ -53,8 +53,11 @@ export class AppComponent { | |||
53 | private _authService: AuthService, | 53 | private _authService: AuthService, |
54 | private _router: Router | 54 | private _router: Router |
55 | ) { | 55 | ) { |
56 | if (localStorage.getItem('access_token')) this.isLoggedIn = true; | 56 | if (localStorage.getItem('access_token')) { |
57 | else this.isLoggedIn = false; | 57 | this.isLoggedIn = true; |
58 | } else { | ||
59 | this.isLoggedIn = false; | ||
60 | } | ||
58 | 61 | ||
59 | this._authService.loginChanged$.subscribe( | 62 | this._authService.loginChanged$.subscribe( |
60 | status => { | 63 | status => { |
@@ -87,7 +90,7 @@ export class AppComponent { | |||
87 | } | 90 | } |
88 | }, | 91 | }, |
89 | error => alert(error) | 92 | error => alert(error) |
90 | ) | 93 | ); |
91 | } | 94 | } |
92 | 95 | ||
93 | quitFriends() { | 96 | quitFriends() { |
@@ -96,6 +99,6 @@ export class AppComponent { | |||
96 | alert('Quit friends!'); | 99 | alert('Quit friends!'); |
97 | }, | 100 | }, |
98 | error => alert(error) | 101 | error => alert(error) |
99 | ) | 102 | ); |
100 | } | 103 | } |
101 | } | 104 | } |
diff --git a/client/angular/friends/services/friends.service.ts b/client/angular/friends/services/friends.service.ts index a34ef0d6f..4eb1fc67b 100644 --- a/client/angular/friends/services/friends.service.ts +++ b/client/angular/friends/services/friends.service.ts | |||
@@ -1,6 +1,6 @@ | |||
1 | import {Injectable} from 'angular2/core'; | 1 | import { Injectable } from 'angular2/core'; |
2 | import {Http, Response, Headers, RequestOptions} from 'angular2/http'; | 2 | import { Http, Response } from 'angular2/http'; |
3 | import {Observable} from 'rxjs/Rx'; | 3 | import { Observable } from 'rxjs/Rx'; |
4 | 4 | ||
5 | @Injectable() | 5 | @Injectable() |
6 | export class FriendsService { | 6 | export class FriendsService { |
diff --git a/client/angular/users/services/auth.service.ts b/client/angular/users/services/auth.service.ts index a512c3d9c..80886346c 100644 --- a/client/angular/users/services/auth.service.ts +++ b/client/angular/users/services/auth.service.ts | |||
@@ -2,19 +2,18 @@ import { Injectable } from 'angular2/core'; | |||
2 | import { Http, Response, Headers, URLSearchParams } from 'angular2/http'; | 2 | import { Http, Response, Headers, URLSearchParams } from 'angular2/http'; |
3 | import { Observable, Subject } from 'rxjs/Rx'; | 3 | import { Observable, Subject } from 'rxjs/Rx'; |
4 | 4 | ||
5 | import { Token } from '../models/token'; | ||
6 | import { AuthStatus } from '../models/authStatus'; | 5 | import { AuthStatus } from '../models/authStatus'; |
7 | 6 | ||
8 | @Injectable() | 7 | @Injectable() |
9 | export class AuthService { | 8 | export class AuthService { |
9 | loginChanged$ = this._loginChanged.asObservable(); | ||
10 | |||
10 | private _loginChanged = new Subject<AuthStatus>(); | 11 | private _loginChanged = new Subject<AuthStatus>(); |
11 | 12 | ||
12 | private _baseLoginUrl = '/api/v1/users/token'; | 13 | private _baseLoginUrl = '/api/v1/users/token'; |
13 | private _clientId = '56f055587305d40b21904240'; | 14 | private _clientId = '56f055587305d40b21904240'; |
14 | private _clientSecret = 'megustalabanana'; | 15 | private _clientSecret = 'megustalabanana'; |
15 | 16 | ||
16 | loginChanged$ = this._loginChanged.asObservable(); | ||
17 | |||
18 | constructor (private http: Http) {} | 17 | constructor (private http: Http) {} |
19 | 18 | ||
20 | login(username: string, password: string) { | 19 | login(username: string, password: string) { |
@@ -32,7 +31,7 @@ export class AuthService { | |||
32 | 31 | ||
33 | let options = { | 32 | let options = { |
34 | headers: headers | 33 | headers: headers |
35 | } | 34 | }; |
36 | 35 | ||
37 | return this.http.post(this._baseLoginUrl, body.toString(), options) | 36 | return this.http.post(this._baseLoginUrl, body.toString(), options) |
38 | .map(res => res.json()) | 37 | .map(res => res.json()) |
diff --git a/client/angular/videos/components/add/videos-add.component.ts b/client/angular/videos/components/add/videos-add.component.ts index 0004cfa20..7ae11db22 100644 --- a/client/angular/videos/components/add/videos-add.component.ts +++ b/client/angular/videos/components/add/videos-add.component.ts | |||
@@ -1,8 +1,5 @@ | |||
1 | import { Component, ElementRef, Inject, OnInit } from 'angular2/core'; | 1 | import { Component, ElementRef, OnInit } from 'angular2/core'; |
2 | import { Router } from 'angular2/router'; | 2 | import { Router } from 'angular2/router'; |
3 | import { NgForm } from 'angular2/common'; | ||
4 | |||
5 | import { Video } from '../../models/video'; | ||
6 | 3 | ||
7 | // TODO: import it with systemjs | 4 | // TODO: import it with systemjs |
8 | declare var jQuery:any; | 5 | declare var jQuery:any; |
diff --git a/client/angular/videos/components/list/videos-list.component.ts b/client/angular/videos/components/list/videos-list.component.ts index eb23ed1ff..ae58f4d7e 100644 --- a/client/angular/videos/components/list/videos-list.component.ts +++ b/client/angular/videos/components/list/videos-list.component.ts | |||
@@ -33,7 +33,7 @@ export class VideosListComponent implements OnInit { | |||
33 | if (this.search !== null) { | 33 | if (this.search !== null) { |
34 | observable = this._videosService.searchVideos(this.search); | 34 | observable = this._videosService.searchVideos(this.search); |
35 | } else { | 35 | } else { |
36 | observable = this._videosService.getVideos() | 36 | observable = this._videosService.getVideos(); |
37 | } | 37 | } |
38 | 38 | ||
39 | observable.subscribe( | 39 | observable.subscribe( |
@@ -46,7 +46,7 @@ export class VideosListComponent implements OnInit { | |||
46 | this._videosService.removeVideo(id).subscribe( | 46 | this._videosService.removeVideo(id).subscribe( |
47 | status => this.getVideos(), | 47 | status => this.getVideos(), |
48 | error => alert(error) | 48 | error => alert(error) |
49 | ) | 49 | ); |
50 | } | 50 | } |
51 | 51 | ||
52 | } | 52 | } |
diff --git a/client/angular/videos/components/watch/videos-watch.component.ts b/client/angular/videos/components/watch/videos-watch.component.ts index 1a17e2b1a..28786ebb9 100644 --- a/client/angular/videos/components/watch/videos-watch.component.ts +++ b/client/angular/videos/components/watch/videos-watch.component.ts | |||
@@ -47,8 +47,8 @@ export class VideosWatchComponent implements OnInit, CanDeactivate { | |||
47 | alert('Cannot append the file.'); | 47 | alert('Cannot append the file.'); |
48 | console.error(err); | 48 | console.error(err); |
49 | } | 49 | } |
50 | }) | 50 | }); |
51 | }) | 51 | }); |
52 | } | 52 | } |
53 | 53 | ||
54 | routerCanDeactivate(next: ComponentInstruction, prev: ComponentInstruction) : any { | 54 | routerCanDeactivate(next: ComponentInstruction, prev: ComponentInstruction) : any { |