From 7ddd02c9b8c1e088f6679a2227f105e6439fc992 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Fri, 27 Jan 2017 16:14:11 +0100 Subject: Client: better notifications for a beautiful world --- client/src/app/account/account.component.html | 1 - client/src/app/account/account.component.ts | 12 ++++++------ 2 files changed, 6 insertions(+), 7 deletions(-) (limited to 'client/src/app/account') 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 @@

Account

-
{{ information }}
{{ error }}
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 @@ -import { } from '@angular/common'; import { Component, OnInit } from '@angular/core'; import { FormBuilder, FormGroup } from '@angular/forms'; import { Router } from '@angular/router'; +import { NotificationsService } from 'angular2-notifications'; + import { AccountService } from './account.service'; import { FormReactive, USER_PASSWORD } from '../shared'; @@ -12,7 +13,6 @@ import { FormReactive, USER_PASSWORD } from '../shared'; }) export class AccountComponent extends FormReactive implements OnInit { - information: string = null; error: string = null; form: FormGroup; @@ -26,9 +26,10 @@ export class AccountComponent extends FormReactive implements OnInit { }; constructor( - private accountService: AccountService, private formBuilder: FormBuilder, - private router: Router + private router: Router, + private notificationsService: NotificationsService, + private accountService: AccountService ) { super(); } @@ -50,7 +51,6 @@ export class AccountComponent extends FormReactive implements OnInit { const newPassword = this.form.value['new-password']; const newConfirmedPassword = this.form.value['new-confirmed-password']; - this.information = null; this.error = null; if (newPassword !== newConfirmedPassword) { @@ -59,7 +59,7 @@ export class AccountComponent extends FormReactive implements OnInit { } this.accountService.changePassword(newPassword).subscribe( - ok => this.information = 'Password updated.', + () => this.notificationsService.success('Success', 'Password updated.'), err => this.error = err ); -- cgit v1.2.3