diff options
author | Chocobozzz <florian.bigard@gmail.com> | 2017-06-16 14:32:15 +0200 |
---|---|---|
committer | Chocobozzz <florian.bigard@gmail.com> | 2017-06-16 14:32:15 +0200 |
commit | df98563e2104b82b119c00a3cd83cd0dc1242d25 (patch) | |
tree | a9720bf01bac9ad5646bd3d3c9bc7653617afdad /client/src/app/account | |
parent | 46757b477c1adb5f98060d15998a3852e18902a6 (diff) | |
download | PeerTube-df98563e2104b82b119c00a3cd83cd0dc1242d25.tar.gz PeerTube-df98563e2104b82b119c00a3cd83cd0dc1242d25.tar.zst PeerTube-df98563e2104b82b119c00a3cd83cd0dc1242d25.zip |
Use typescript standard and lint all files
Diffstat (limited to 'client/src/app/account')
8 files changed, 76 insertions, 76 deletions
diff --git a/client/src/app/account/account-change-password/account-change-password.component.ts b/client/src/app/account/account-change-password/account-change-password.component.ts index 15dc42d22..ce786cfa3 100644 --- a/client/src/app/account/account-change-password/account-change-password.component.ts +++ b/client/src/app/account/account-change-password/account-change-password.component.ts | |||
@@ -1,10 +1,10 @@ | |||
1 | import { Component, OnInit } from '@angular/core'; | 1 | import { Component, OnInit } from '@angular/core' |
2 | import { FormBuilder, FormGroup } from '@angular/forms'; | 2 | import { FormBuilder, FormGroup } from '@angular/forms' |
3 | import { Router } from '@angular/router'; | 3 | import { Router } from '@angular/router' |
4 | 4 | ||
5 | import { NotificationsService } from 'angular2-notifications'; | 5 | import { NotificationsService } from 'angular2-notifications' |
6 | 6 | ||
7 | import { FormReactive, UserService, USER_PASSWORD } from '../../shared'; | 7 | import { FormReactive, UserService, USER_PASSWORD } from '../../shared' |
8 | 8 | ||
9 | @Component({ | 9 | @Component({ |
10 | selector: 'my-account-change-password', | 10 | selector: 'my-account-change-password', |
@@ -12,55 +12,55 @@ import { FormReactive, UserService, USER_PASSWORD } from '../../shared'; | |||
12 | }) | 12 | }) |
13 | 13 | ||
14 | export class AccountChangePasswordComponent extends FormReactive implements OnInit { | 14 | export class AccountChangePasswordComponent extends FormReactive implements OnInit { |
15 | error: string = null; | 15 | error: string = null |
16 | 16 | ||
17 | form: FormGroup; | 17 | form: FormGroup |
18 | formErrors = { | 18 | formErrors = { |
19 | 'new-password': '', | 19 | 'new-password': '', |
20 | 'new-confirmed-password': '' | 20 | 'new-confirmed-password': '' |
21 | }; | 21 | } |
22 | validationMessages = { | 22 | validationMessages = { |
23 | 'new-password': USER_PASSWORD.MESSAGES, | 23 | 'new-password': USER_PASSWORD.MESSAGES, |
24 | 'new-confirmed-password': USER_PASSWORD.MESSAGES | 24 | 'new-confirmed-password': USER_PASSWORD.MESSAGES |
25 | }; | 25 | } |
26 | 26 | ||
27 | constructor( | 27 | constructor ( |
28 | private formBuilder: FormBuilder, | 28 | private formBuilder: FormBuilder, |
29 | private router: Router, | 29 | private router: Router, |
30 | private notificationsService: NotificationsService, | 30 | private notificationsService: NotificationsService, |
31 | private userService: UserService | 31 | private userService: UserService |
32 | ) { | 32 | ) { |
33 | super(); | 33 | super() |
34 | } | 34 | } |
35 | 35 | ||
36 | buildForm() { | 36 | buildForm () { |
37 | this.form = this.formBuilder.group({ | 37 | this.form = this.formBuilder.group({ |
38 | 'new-password': [ '', USER_PASSWORD.VALIDATORS ], | 38 | 'new-password': [ '', USER_PASSWORD.VALIDATORS ], |
39 | 'new-confirmed-password': [ '', USER_PASSWORD.VALIDATORS ], | 39 | 'new-confirmed-password': [ '', USER_PASSWORD.VALIDATORS ] |
40 | }); | 40 | }) |
41 | 41 | ||
42 | this.form.valueChanges.subscribe(data => this.onValueChanged(data)); | 42 | this.form.valueChanges.subscribe(data => this.onValueChanged(data)) |
43 | } | 43 | } |
44 | 44 | ||
45 | ngOnInit() { | 45 | ngOnInit () { |
46 | this.buildForm(); | 46 | this.buildForm() |
47 | } | 47 | } |
48 | 48 | ||
49 | changePassword() { | 49 | changePassword () { |
50 | const newPassword = this.form.value['new-password']; | 50 | const newPassword = this.form.value['new-password'] |
51 | const newConfirmedPassword = this.form.value['new-confirmed-password']; | 51 | const newConfirmedPassword = this.form.value['new-confirmed-password'] |
52 | 52 | ||
53 | this.error = null; | 53 | this.error = null |
54 | 54 | ||
55 | if (newPassword !== newConfirmedPassword) { | 55 | if (newPassword !== newConfirmedPassword) { |
56 | this.error = 'The new password and the confirmed password do not correspond.'; | 56 | this.error = 'The new password and the confirmed password do not correspond.' |
57 | return; | 57 | return |
58 | } | 58 | } |
59 | 59 | ||
60 | this.userService.changePassword(newPassword).subscribe( | 60 | this.userService.changePassword(newPassword).subscribe( |
61 | () => this.notificationsService.success('Success', 'Password updated.'), | 61 | () => this.notificationsService.success('Success', 'Password updated.'), |
62 | 62 | ||
63 | err => this.error = err | 63 | err => this.error = err |
64 | ); | 64 | ) |
65 | } | 65 | } |
66 | } | 66 | } |
diff --git a/client/src/app/account/account-change-password/index.ts b/client/src/app/account/account-change-password/index.ts index 72a63e48d..44c330b66 100644 --- a/client/src/app/account/account-change-password/index.ts +++ b/client/src/app/account/account-change-password/index.ts | |||
@@ -1 +1 @@ | |||
export * from './account-change-password.component'; | export * from './account-change-password.component' | ||
diff --git a/client/src/app/account/account-details/account-details.component.ts b/client/src/app/account/account-details/account-details.component.ts index 30e5b14ee..d7531cb55 100644 --- a/client/src/app/account/account-details/account-details.component.ts +++ b/client/src/app/account/account-details/account-details.component.ts | |||
@@ -1,16 +1,16 @@ | |||
1 | import { Component, OnInit, Input } from '@angular/core'; | 1 | import { Component, OnInit, Input } from '@angular/core' |
2 | import { FormBuilder, FormGroup } from '@angular/forms'; | 2 | import { FormBuilder, FormGroup } from '@angular/forms' |
3 | import { Router } from '@angular/router'; | 3 | import { Router } from '@angular/router' |
4 | 4 | ||
5 | import { NotificationsService } from 'angular2-notifications'; | 5 | import { NotificationsService } from 'angular2-notifications' |
6 | 6 | ||
7 | import { AuthService } from '../../core'; | 7 | import { AuthService } from '../../core' |
8 | import { | 8 | import { |
9 | FormReactive, | 9 | FormReactive, |
10 | User, | 10 | User, |
11 | UserService, | 11 | UserService, |
12 | USER_PASSWORD | 12 | USER_PASSWORD |
13 | } from '../../shared'; | 13 | } from '../../shared' |
14 | 14 | ||
15 | @Component({ | 15 | @Component({ |
16 | selector: 'my-account-details', | 16 | selector: 'my-account-details', |
@@ -18,51 +18,51 @@ import { | |||
18 | }) | 18 | }) |
19 | 19 | ||
20 | export class AccountDetailsComponent extends FormReactive implements OnInit { | 20 | export class AccountDetailsComponent extends FormReactive implements OnInit { |
21 | @Input() user: User = null; | 21 | @Input() user: User = null |
22 | 22 | ||
23 | error: string = null; | 23 | error: string = null |
24 | 24 | ||
25 | form: FormGroup; | 25 | form: FormGroup |
26 | formErrors = {}; | 26 | formErrors = {} |
27 | validationMessages = {}; | 27 | validationMessages = {} |
28 | 28 | ||
29 | constructor( | 29 | constructor ( |
30 | private authService: AuthService, | 30 | private authService: AuthService, |
31 | private formBuilder: FormBuilder, | 31 | private formBuilder: FormBuilder, |
32 | private router: Router, | 32 | private router: Router, |
33 | private notificationsService: NotificationsService, | 33 | private notificationsService: NotificationsService, |
34 | private userService: UserService | 34 | private userService: UserService |
35 | ) { | 35 | ) { |
36 | super(); | 36 | super() |
37 | } | 37 | } |
38 | 38 | ||
39 | buildForm() { | 39 | buildForm () { |
40 | this.form = this.formBuilder.group({ | 40 | this.form = this.formBuilder.group({ |
41 | displayNSFW: [ this.user.displayNSFW ], | 41 | displayNSFW: [ this.user.displayNSFW ] |
42 | }); | 42 | }) |
43 | 43 | ||
44 | this.form.valueChanges.subscribe(data => this.onValueChanged(data)); | 44 | this.form.valueChanges.subscribe(data => this.onValueChanged(data)) |
45 | } | 45 | } |
46 | 46 | ||
47 | ngOnInit() { | 47 | ngOnInit () { |
48 | this.buildForm(); | 48 | this.buildForm() |
49 | } | 49 | } |
50 | 50 | ||
51 | updateDetails() { | 51 | updateDetails () { |
52 | const displayNSFW = this.form.value['displayNSFW']; | 52 | const displayNSFW = this.form.value['displayNSFW'] |
53 | const details = { | 53 | const details = { |
54 | displayNSFW | 54 | displayNSFW |
55 | }; | 55 | } |
56 | 56 | ||
57 | this.error = null; | 57 | this.error = null |
58 | this.userService.updateDetails(details).subscribe( | 58 | this.userService.updateDetails(details).subscribe( |
59 | () => { | 59 | () => { |
60 | this.notificationsService.success('Success', 'Informations updated.'); | 60 | this.notificationsService.success('Success', 'Informations updated.') |
61 | 61 | ||
62 | this.authService.refreshUserInformations(); | 62 | this.authService.refreshUserInformations() |
63 | }, | 63 | }, |
64 | 64 | ||
65 | err => this.error = err | 65 | err => this.error = err |
66 | ); | 66 | ) |
67 | } | 67 | } |
68 | } | 68 | } |
diff --git a/client/src/app/account/account-details/index.ts b/client/src/app/account/account-details/index.ts index 28f644738..4829f608a 100644 --- a/client/src/app/account/account-details/index.ts +++ b/client/src/app/account/account-details/index.ts | |||
@@ -1 +1 @@ | |||
export * from './account-details.component'; | export * from './account-details.component' | ||
diff --git a/client/src/app/account/account-routing.module.ts b/client/src/app/account/account-routing.module.ts index 9004605f3..e9b8f7031 100644 --- a/client/src/app/account/account-routing.module.ts +++ b/client/src/app/account/account-routing.module.ts | |||
@@ -1,7 +1,7 @@ | |||
1 | import { NgModule } from '@angular/core'; | 1 | import { NgModule } from '@angular/core' |
2 | import { RouterModule, Routes } from '@angular/router'; | 2 | import { RouterModule, Routes } from '@angular/router' |
3 | 3 | ||
4 | import { AccountComponent } from './account.component'; | 4 | import { AccountComponent } from './account.component' |
5 | 5 | ||
6 | const accountRoutes: Routes = [ | 6 | const accountRoutes: Routes = [ |
7 | { | 7 | { |
@@ -13,7 +13,7 @@ const accountRoutes: Routes = [ | |||
13 | } | 13 | } |
14 | } | 14 | } |
15 | } | 15 | } |
16 | ]; | 16 | ] |
17 | 17 | ||
18 | @NgModule({ | 18 | @NgModule({ |
19 | imports: [ RouterModule.forChild(accountRoutes) ], | 19 | imports: [ RouterModule.forChild(accountRoutes) ], |
diff --git a/client/src/app/account/account.component.ts b/client/src/app/account/account.component.ts index 57b3d4ccd..929934f67 100644 --- a/client/src/app/account/account.component.ts +++ b/client/src/app/account/account.component.ts | |||
@@ -1,16 +1,16 @@ | |||
1 | import { Component, OnInit } from '@angular/core'; | 1 | import { Component, OnInit } from '@angular/core' |
2 | import { FormBuilder, FormGroup } from '@angular/forms'; | 2 | import { FormBuilder, FormGroup } from '@angular/forms' |
3 | import { Router } from '@angular/router'; | 3 | import { Router } from '@angular/router' |
4 | 4 | ||
5 | import { NotificationsService } from 'angular2-notifications'; | 5 | import { NotificationsService } from 'angular2-notifications' |
6 | 6 | ||
7 | import { AuthService } from '../core'; | 7 | import { AuthService } from '../core' |
8 | import { | 8 | import { |
9 | FormReactive, | 9 | FormReactive, |
10 | User, | 10 | User, |
11 | UserService, | 11 | UserService, |
12 | USER_PASSWORD | 12 | USER_PASSWORD |
13 | } from '../shared'; | 13 | } from '../shared' |
14 | 14 | ||
15 | @Component({ | 15 | @Component({ |
16 | selector: 'my-account', | 16 | selector: 'my-account', |
@@ -18,11 +18,11 @@ import { | |||
18 | styleUrls: [ './account.component.scss' ] | 18 | styleUrls: [ './account.component.scss' ] |
19 | }) | 19 | }) |
20 | export class AccountComponent implements OnInit { | 20 | export class AccountComponent implements OnInit { |
21 | user: User = null; | 21 | user: User = null |
22 | 22 | ||
23 | constructor(private authService: AuthService) {} | 23 | constructor (private authService: AuthService) {} |
24 | 24 | ||
25 | ngOnInit() { | 25 | ngOnInit () { |
26 | this.user = this.authService.getUser(); | 26 | this.user = this.authService.getUser() |
27 | } | 27 | } |
28 | } | 28 | } |
diff --git a/client/src/app/account/account.module.ts b/client/src/app/account/account.module.ts index f6c141ae6..380e9d235 100644 --- a/client/src/app/account/account.module.ts +++ b/client/src/app/account/account.module.ts | |||
@@ -1,11 +1,11 @@ | |||
1 | import { NgModule } from '@angular/core'; | 1 | import { NgModule } from '@angular/core' |
2 | 2 | ||
3 | import { AccountRoutingModule } from './account-routing.module'; | 3 | import { AccountRoutingModule } from './account-routing.module' |
4 | import { AccountComponent } from './account.component'; | 4 | import { AccountComponent } from './account.component' |
5 | import { AccountChangePasswordComponent } from './account-change-password'; | 5 | import { AccountChangePasswordComponent } from './account-change-password' |
6 | import { AccountDetailsComponent } from './account-details'; | 6 | import { AccountDetailsComponent } from './account-details' |
7 | import { AccountService } from './account.service'; | 7 | import { AccountService } from './account.service' |
8 | import { SharedModule } from '../shared'; | 8 | import { SharedModule } from '../shared' |
9 | 9 | ||
10 | @NgModule({ | 10 | @NgModule({ |
11 | imports: [ | 11 | imports: [ |
diff --git a/client/src/app/account/index.ts b/client/src/app/account/index.ts index 9265fa10a..dc56ffdbd 100644 --- a/client/src/app/account/index.ts +++ b/client/src/app/account/index.ts | |||
@@ -1,3 +1,3 @@ | |||
1 | export * from './account-routing.module'; | 1 | export * from './account-routing.module' |
2 | export * from './account.component'; | 2 | export * from './account.component' |
3 | export * from './account.module'; | 3 | export * from './account.module' |