diff options
author | Chocobozzz <florian.bigard@gmail.com> | 2017-09-14 11:57:49 +0200 |
---|---|---|
committer | Chocobozzz <florian.bigard@gmail.com> | 2017-09-14 11:57:49 +0200 |
commit | d592e0a9b2931c7c9cbedb27fb8efc9aaacad9bb (patch) | |
tree | 549b14b842de296efed846a11b3681efe08cfa9e /client/src/app/shared/users | |
parent | 91f6f169b1110eeae6ebf5c387f4204b0d07703c (diff) | |
download | PeerTube-d592e0a9b2931c7c9cbedb27fb8efc9aaacad9bb.tar.gz PeerTube-d592e0a9b2931c7c9cbedb27fb8efc9aaacad9bb.tar.zst PeerTube-d592e0a9b2931c7c9cbedb27fb8efc9aaacad9bb.zip |
Move to HttpClient and PrimeNG data table
Diffstat (limited to 'client/src/app/shared/users')
-rw-r--r-- | client/src/app/shared/users/user.service.ts | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/client/src/app/shared/users/user.service.ts b/client/src/app/shared/users/user.service.ts index 35180be4d..5c089d221 100644 --- a/client/src/app/shared/users/user.service.ts +++ b/client/src/app/shared/users/user.service.ts | |||
@@ -1,10 +1,8 @@ | |||
1 | import { Injectable } from '@angular/core' | 1 | import { Injectable } from '@angular/core' |
2 | import { Http } from '@angular/http' | 2 | import { HttpClient } from '@angular/common/http' |
3 | import 'rxjs/add/operator/catch' | 3 | import 'rxjs/add/operator/catch' |
4 | import 'rxjs/add/operator/map' | 4 | import 'rxjs/add/operator/map' |
5 | 5 | ||
6 | import { AuthService } from '../../core' | ||
7 | import { AuthHttp } from '../auth' | ||
8 | import { RestExtractor } from '../rest' | 6 | import { RestExtractor } from '../rest' |
9 | import { UserCreate, UserUpdateMe } from '../../../../../shared' | 7 | import { UserCreate, UserUpdateMe } from '../../../../../shared' |
10 | 8 | ||
@@ -13,9 +11,7 @@ export class UserService { | |||
13 | static BASE_USERS_URL = API_URL + '/api/v1/users/' | 11 | static BASE_USERS_URL = API_URL + '/api/v1/users/' |
14 | 12 | ||
15 | constructor ( | 13 | constructor ( |
16 | private http: Http, | 14 | private authHttp: HttpClient, |
17 | private authHttp: AuthHttp, | ||
18 | private authService: AuthService, | ||
19 | private restExtractor: RestExtractor | 15 | private restExtractor: RestExtractor |
20 | ) {} | 16 | ) {} |
21 | 17 | ||
@@ -34,7 +30,7 @@ export class UserService { | |||
34 | 30 | ||
35 | return this.authHttp.put(url, body) | 31 | return this.authHttp.put(url, body) |
36 | .map(this.restExtractor.extractDataBool) | 32 | .map(this.restExtractor.extractDataBool) |
37 | .catch((res) => this.restExtractor.handleError(res)) | 33 | .catch(res => this.restExtractor.handleError(res)) |
38 | } | 34 | } |
39 | 35 | ||
40 | updateMyDetails (details: UserUpdateMe) { | 36 | updateMyDetails (details: UserUpdateMe) { |
@@ -42,12 +38,12 @@ export class UserService { | |||
42 | 38 | ||
43 | return this.authHttp.put(url, details) | 39 | return this.authHttp.put(url, details) |
44 | .map(this.restExtractor.extractDataBool) | 40 | .map(this.restExtractor.extractDataBool) |
45 | .catch((res) => this.restExtractor.handleError(res)) | 41 | .catch(res => this.restExtractor.handleError(res)) |
46 | } | 42 | } |
47 | 43 | ||
48 | signup (userCreate: UserCreate) { | 44 | signup (userCreate: UserCreate) { |
49 | return this.http.post(UserService.BASE_USERS_URL + 'register', userCreate) | 45 | return this.authHttp.post(UserService.BASE_USERS_URL + 'register', userCreate) |
50 | .map(this.restExtractor.extractDataBool) | 46 | .map(this.restExtractor.extractDataBool) |
51 | .catch(this.restExtractor.handleError) | 47 | .catch(res => this.restExtractor.handleError(res)) |
52 | } | 48 | } |
53 | } | 49 | } |