aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/account
diff options
context:
space:
mode:
authorChocobozzz <florian.bigard@gmail.com>2017-01-27 16:14:11 +0100
committerChocobozzz <florian.bigard@gmail.com>2017-01-27 16:14:11 +0100
commit7ddd02c9b8c1e088f6679a2227f105e6439fc992 (patch)
treea1ff7af17f2a95abe85a2380834957e44032e8c2 /client/src/app/account
parentcddadde81f91219204cec1f4057a191c02a70894 (diff)
downloadPeerTube-7ddd02c9b8c1e088f6679a2227f105e6439fc992.tar.gz
PeerTube-7ddd02c9b8c1e088f6679a2227f105e6439fc992.tar.zst
PeerTube-7ddd02c9b8c1e088f6679a2227f105e6439fc992.zip
Client: better notifications for a beautiful world
Diffstat (limited to 'client/src/app/account')
-rw-r--r--client/src/app/account/account.component.html1
-rw-r--r--client/src/app/account/account.component.ts12
2 files changed, 6 insertions, 7 deletions
diff --git a/client/src/app/account/account.component.html b/client/src/app/account/account.component.html
index 5a8847acd..2fbb5a908 100644
--- a/client/src/app/account/account.component.html
+++ b/client/src/app/account/account.component.html
@@ -1,6 +1,5 @@
1<h3>Account</h3> 1<h3>Account</h3>
2 2
3<div *ngIf="information" class="alert alert-success">{{ information }}</div>
4<div *ngIf="error" class="alert alert-danger">{{ error }}</div> 3<div *ngIf="error" class="alert alert-danger">{{ error }}</div>
5 4
6<form role="form" (ngSubmit)="changePassword()" [formGroup]="form"> 5<form role="form" (ngSubmit)="changePassword()" [formGroup]="form">
diff --git a/client/src/app/account/account.component.ts b/client/src/app/account/account.component.ts
index 851eaf198..9b6b5fbf4 100644
--- a/client/src/app/account/account.component.ts
+++ b/client/src/app/account/account.component.ts
@@ -1,8 +1,9 @@
1import { } from '@angular/common';
2import { Component, OnInit } from '@angular/core'; 1import { Component, OnInit } from '@angular/core';
3import { FormBuilder, FormGroup } from '@angular/forms'; 2import { FormBuilder, FormGroup } from '@angular/forms';
4import { Router } from '@angular/router'; 3import { Router } from '@angular/router';
5 4
5import { NotificationsService } from 'angular2-notifications';
6
6import { AccountService } from './account.service'; 7import { AccountService } from './account.service';
7import { FormReactive, USER_PASSWORD } from '../shared'; 8import { FormReactive, USER_PASSWORD } from '../shared';
8 9
@@ -12,7 +13,6 @@ import { FormReactive, USER_PASSWORD } from '../shared';
12}) 13})
13 14
14export class AccountComponent extends FormReactive implements OnInit { 15export class AccountComponent extends FormReactive implements OnInit {
15 information: string = null;
16 error: string = null; 16 error: string = null;
17 17
18 form: FormGroup; 18 form: FormGroup;
@@ -26,9 +26,10 @@ export class AccountComponent extends FormReactive implements OnInit {
26 }; 26 };
27 27
28 constructor( 28 constructor(
29 private accountService: AccountService,
30 private formBuilder: FormBuilder, 29 private formBuilder: FormBuilder,
31 private router: Router 30 private router: Router,
31 private notificationsService: NotificationsService,
32 private accountService: AccountService
32 ) { 33 ) {
33 super(); 34 super();
34 } 35 }
@@ -50,7 +51,6 @@ export class AccountComponent extends FormReactive implements OnInit {
50 const newPassword = this.form.value['new-password']; 51 const newPassword = this.form.value['new-password'];
51 const newConfirmedPassword = this.form.value['new-confirmed-password']; 52 const newConfirmedPassword = this.form.value['new-confirmed-password'];
52 53
53 this.information = null;
54 this.error = null; 54 this.error = null;
55 55
56 if (newPassword !== newConfirmedPassword) { 56 if (newPassword !== newConfirmedPassword) {
@@ -59,7 +59,7 @@ export class AccountComponent extends FormReactive implements OnInit {
59 } 59 }
60 60
61 this.accountService.changePassword(newPassword).subscribe( 61 this.accountService.changePassword(newPassword).subscribe(
62 ok => this.information = 'Password updated.', 62 () => this.notificationsService.success('Success', 'Password updated.'),
63 63
64 err => this.error = err 64 err => this.error = err
65 ); 65 );