aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/account
diff options
context:
space:
mode:
Diffstat (limited to 'client/src/app/account')
-rw-r--r--client/src/app/account/account.component.ts7
-rw-r--r--client/src/app/account/account.module.ts4
-rw-r--r--client/src/app/account/account.service.ts28
-rw-r--r--client/src/app/account/index.ts1
4 files changed, 4 insertions, 36 deletions
diff --git a/client/src/app/account/account.component.ts b/client/src/app/account/account.component.ts
index 9b6b5fbf4..14452a73e 100644
--- a/client/src/app/account/account.component.ts
+++ b/client/src/app/account/account.component.ts
@@ -4,8 +4,7 @@ import { Router } from '@angular/router';
4 4
5import { NotificationsService } from 'angular2-notifications'; 5import { NotificationsService } from 'angular2-notifications';
6 6
7import { AccountService } from './account.service'; 7import { FormReactive, UserService, USER_PASSWORD } from '../shared';
8import { FormReactive, USER_PASSWORD } from '../shared';
9 8
10@Component({ 9@Component({
11 selector: 'my-account', 10 selector: 'my-account',
@@ -29,7 +28,7 @@ export class AccountComponent extends FormReactive implements OnInit {
29 private formBuilder: FormBuilder, 28 private formBuilder: FormBuilder,
30 private router: Router, 29 private router: Router,
31 private notificationsService: NotificationsService, 30 private notificationsService: NotificationsService,
32 private accountService: AccountService 31 private userService: UserService
33 ) { 32 ) {
34 super(); 33 super();
35 } 34 }
@@ -58,7 +57,7 @@ export class AccountComponent extends FormReactive implements OnInit {
58 return; 57 return;
59 } 58 }
60 59
61 this.accountService.changePassword(newPassword).subscribe( 60 this.userService.changePassword(newPassword).subscribe(
62 () => this.notificationsService.success('Success', 'Password updated.'), 61 () => this.notificationsService.success('Success', 'Password updated.'),
63 62
64 err => this.error = err 63 err => this.error = err
diff --git a/client/src/app/account/account.module.ts b/client/src/app/account/account.module.ts
index 53f6ba58e..75f2ee6f9 100644
--- a/client/src/app/account/account.module.ts
+++ b/client/src/app/account/account.module.ts
@@ -19,8 +19,6 @@ import { SharedModule } from '../shared';
19 AccountComponent 19 AccountComponent
20 ], 20 ],
21 21
22 providers: [ 22 providers: []
23 AccountService
24 ]
25}) 23})
26export class AccountModule { } 24export class AccountModule { }
diff --git a/client/src/app/account/account.service.ts b/client/src/app/account/account.service.ts
deleted file mode 100644
index 046690347..000000000
--- a/client/src/app/account/account.service.ts
+++ /dev/null
@@ -1,28 +0,0 @@
1import { Injectable } from '@angular/core';
2import 'rxjs/add/operator/catch';
3import 'rxjs/add/operator/map';
4
5import { AuthService } from '../core';
6import { AuthHttp, RestExtractor } from '../shared';
7
8@Injectable()
9export class AccountService {
10 private static BASE_USERS_URL = '/api/v1/users/';
11
12 constructor(
13 private authHttp: AuthHttp,
14 private authService: AuthService,
15 private restExtractor: RestExtractor
16 ) {}
17
18 changePassword(newPassword: string) {
19 const url = AccountService.BASE_USERS_URL + this.authService.getUser().id;
20 const body = {
21 password: newPassword
22 };
23
24 return this.authHttp.put(url, body)
25 .map(this.restExtractor.extractDataBool)
26 .catch((res) => this.restExtractor.handleError(res));
27 }
28}
diff --git a/client/src/app/account/index.ts b/client/src/app/account/index.ts
index be03713cb..9265fa10a 100644
--- a/client/src/app/account/index.ts
+++ b/client/src/app/account/index.ts
@@ -1,4 +1,3 @@
1export * from './account-routing.module'; 1export * from './account-routing.module';
2export * from './account.component'; 2export * from './account.component';
3export * from './account.module'; 3export * from './account.module';
4export * from './account.service';