From 44124980c55d5a5ec7dfb8e71bf14d10f0fe975d Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Fri, 8 Apr 2016 20:58:07 +0200 Subject: Add typescript (and angular2) linter --- client/angular/app/app.component.ts | 11 +++++++---- client/angular/friends/services/friends.service.ts | 6 +++--- client/angular/users/services/auth.service.ts | 7 +++---- client/angular/videos/components/add/videos-add.component.ts | 5 +---- .../angular/videos/components/list/videos-list.component.ts | 4 ++-- .../angular/videos/components/watch/videos-watch.component.ts | 4 ++-- 6 files changed, 18 insertions(+), 19 deletions(-) (limited to 'client/angular') 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 { private _authService: AuthService, private _router: Router ) { - if (localStorage.getItem('access_token')) this.isLoggedIn = true; - else this.isLoggedIn = false; + if (localStorage.getItem('access_token')) { + this.isLoggedIn = true; + } else { + this.isLoggedIn = false; + } this._authService.loginChanged$.subscribe( status => { @@ -87,7 +90,7 @@ export class AppComponent { } }, error => alert(error) - ) + ); } quitFriends() { @@ -96,6 +99,6 @@ export class AppComponent { alert('Quit friends!'); }, error => alert(error) - ) + ); } } 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 @@ -import {Injectable} from 'angular2/core'; -import {Http, Response, Headers, RequestOptions} from 'angular2/http'; -import {Observable} from 'rxjs/Rx'; +import { Injectable } from 'angular2/core'; +import { Http, Response } from 'angular2/http'; +import { Observable } from 'rxjs/Rx'; @Injectable() 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'; import { Http, Response, Headers, URLSearchParams } from 'angular2/http'; import { Observable, Subject } from 'rxjs/Rx'; -import { Token } from '../models/token'; import { AuthStatus } from '../models/authStatus'; @Injectable() export class AuthService { + loginChanged$ = this._loginChanged.asObservable(); + private _loginChanged = new Subject(); private _baseLoginUrl = '/api/v1/users/token'; private _clientId = '56f055587305d40b21904240'; private _clientSecret = 'megustalabanana'; - loginChanged$ = this._loginChanged.asObservable(); - constructor (private http: Http) {} login(username: string, password: string) { @@ -32,7 +31,7 @@ export class AuthService { let options = { headers: headers - } + }; return this.http.post(this._baseLoginUrl, body.toString(), options) .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 @@ -import { Component, ElementRef, Inject, OnInit } from 'angular2/core'; +import { Component, ElementRef, OnInit } from 'angular2/core'; import { Router } from 'angular2/router'; -import { NgForm } from 'angular2/common'; - -import { Video } from '../../models/video'; // TODO: import it with systemjs 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 { if (this.search !== null) { observable = this._videosService.searchVideos(this.search); } else { - observable = this._videosService.getVideos() + observable = this._videosService.getVideos(); } observable.subscribe( @@ -46,7 +46,7 @@ export class VideosListComponent implements OnInit { this._videosService.removeVideo(id).subscribe( status => this.getVideos(), error => alert(error) - ) + ); } } 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 { alert('Cannot append the file.'); console.error(err); } - }) - }) + }); + }); } routerCanDeactivate(next: ComponentInstruction, prev: ComponentInstruction) : any { -- cgit v1.2.3