From df98563e2104b82b119c00a3cd83cd0dc1242d25 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Fri, 16 Jun 2017 14:32:15 +0200 Subject: Use typescript standard and lint all files --- client/src/app/login/index.ts | 6 ++-- client/src/app/login/login-routing.module.ts | 8 ++--- client/src/app/login/login.component.ts | 50 ++++++++++++++-------------- client/src/app/login/login.module.ts | 8 ++--- 4 files changed, 36 insertions(+), 36 deletions(-) (limited to 'client/src/app/login') diff --git a/client/src/app/login/index.ts b/client/src/app/login/index.ts index 5639915f7..f1301d8b5 100644 --- a/client/src/app/login/index.ts +++ b/client/src/app/login/index.ts @@ -1,3 +1,3 @@ -export * from './login-routing.module'; -export * from './login.component'; -export * from './login.module'; +export * from './login-routing.module' +export * from './login.component' +export * from './login.module' diff --git a/client/src/app/login/login-routing.module.ts b/client/src/app/login/login-routing.module.ts index 371993884..1a91677c0 100644 --- a/client/src/app/login/login-routing.module.ts +++ b/client/src/app/login/login-routing.module.ts @@ -1,7 +1,7 @@ -import { NgModule } from '@angular/core'; -import { RouterModule, Routes } from '@angular/router'; +import { NgModule } from '@angular/core' +import { RouterModule, Routes } from '@angular/router' -import { LoginComponent } from './login.component'; +import { LoginComponent } from './login.component' const loginRoutes: Routes = [ { @@ -13,7 +13,7 @@ const loginRoutes: Routes = [ } } } -]; +] @NgModule({ imports: [ RouterModule.forChild(loginRoutes) ], diff --git a/client/src/app/login/login.component.ts b/client/src/app/login/login.component.ts index fd4a314cc..77703a80c 100644 --- a/client/src/app/login/login.component.ts +++ b/client/src/app/login/login.component.ts @@ -1,9 +1,9 @@ -import { Component, OnInit } from '@angular/core'; -import { FormBuilder, FormGroup, Validators } from '@angular/forms'; -import { Router } from '@angular/router'; +import { Component, OnInit } from '@angular/core' +import { FormBuilder, FormGroup, Validators } from '@angular/forms' +import { Router } from '@angular/router' -import { AuthService } from '../core'; -import { FormReactive } from '../shared'; +import { AuthService } from '../core' +import { FormReactive } from '../shared' @Component({ selector: 'my-login', @@ -11,60 +11,60 @@ import { FormReactive } from '../shared'; }) export class LoginComponent extends FormReactive implements OnInit { - error: string = null; + error: string = null - form: FormGroup; + form: FormGroup formErrors = { 'username': '', 'password': '' - }; + } validationMessages = { 'username': { - 'required': 'Username is required.', + 'required': 'Username is required.' }, 'password': { 'required': 'Password is required.' } - }; + } - constructor( + constructor ( private authService: AuthService, private formBuilder: FormBuilder, private router: Router ) { - super(); + super() } - buildForm() { + buildForm () { this.form = this.formBuilder.group({ username: [ '', Validators.required ], - password: [ '', Validators.required ], - }); + password: [ '', Validators.required ] + }) - this.form.valueChanges.subscribe(data => this.onValueChanged(data)); + this.form.valueChanges.subscribe(data => this.onValueChanged(data)) } - ngOnInit() { - this.buildForm(); + ngOnInit () { + this.buildForm() } - login() { - this.error = null; + login () { + this.error = null - const { username, password } = this.form.value; + const { username, password } = this.form.value this.authService.login(username, password).subscribe( result => this.router.navigate(['/videos/list']), error => { - console.error(error.json); + console.error(error.json) if (error.json.error === 'invalid_grant') { - this.error = 'Credentials are invalid.'; + this.error = 'Credentials are invalid.' } else { - this.error = `${error.json.error}: ${error.json.error_description}`; + this.error = `${error.json.error}: ${error.json.error_description}` } } - ); + ) } } diff --git a/client/src/app/login/login.module.ts b/client/src/app/login/login.module.ts index 31a723b43..1de72dbaa 100644 --- a/client/src/app/login/login.module.ts +++ b/client/src/app/login/login.module.ts @@ -1,8 +1,8 @@ -import { NgModule } from '@angular/core'; +import { NgModule } from '@angular/core' -import { LoginRoutingModule } from './login-routing.module'; -import { LoginComponent } from './login.component'; -import { SharedModule } from '../shared'; +import { LoginRoutingModule } from './login-routing.module' +import { LoginComponent } from './login.component' +import { SharedModule } from '../shared' @NgModule({ imports: [ -- cgit v1.2.3