]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blame - client/src/app/account/account.service.ts
Client: split in angular modules
[github/Chocobozzz/PeerTube.git] / client / src / app / account / account.service.ts
CommitLineData
629d8d6f
C
1import { Injectable } from '@angular/core';
2
693b1aba
C
3import { AuthService } from '../core';
4import { AuthHttp, RestExtractor } from '../shared';
629d8d6f
C
5
6@Injectable()
7export class AccountService {
8 private static BASE_USERS_URL = '/api/v1/users/';
9
de59c48f
C
10 constructor(
11 private authHttp: AuthHttp,
12 private authService: AuthService,
13 private restExtractor: RestExtractor
14 ) {}
629d8d6f
C
15
16 changePassword(newPassword: string) {
17 const url = AccountService.BASE_USERS_URL + this.authService.getUser().id;
18 const body = {
19 password: newPassword
20 };
21
de59c48f
C
22 return this.authHttp.put(url, body)
23 .map(this.restExtractor.extractDataBool)
24 .catch((res) => this.restExtractor.handleError(res));
629d8d6f
C
25 }
26}