aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/shared/users
diff options
context:
space:
mode:
Diffstat (limited to 'client/src/app/shared/users')
-rw-r--r--client/src/app/shared/users/user.service.ts14
1 files changed, 14 insertions, 0 deletions
diff --git a/client/src/app/shared/users/user.service.ts b/client/src/app/shared/users/user.service.ts
index 0d41b900d..0727b76fd 100644
--- a/client/src/app/shared/users/user.service.ts
+++ b/client/src/app/shared/users/user.service.ts
@@ -1,4 +1,5 @@
1import { Injectable } from '@angular/core'; 1import { Injectable } from '@angular/core';
2import { Http } from '@angular/http';
2import 'rxjs/add/operator/catch'; 3import 'rxjs/add/operator/catch';
3import 'rxjs/add/operator/map'; 4import 'rxjs/add/operator/map';
4 5
@@ -11,6 +12,7 @@ export class UserService {
11 static BASE_USERS_URL = '/api/v1/users/'; 12 static BASE_USERS_URL = '/api/v1/users/';
12 13
13 constructor( 14 constructor(
15 private http: Http,
14 private authHttp: AuthHttp, 16 private authHttp: AuthHttp,
15 private authService: AuthService, 17 private authService: AuthService,
16 private restExtractor: RestExtractor 18 private restExtractor: RestExtractor
@@ -41,4 +43,16 @@ export class UserService {
41 .map(this.restExtractor.extractDataBool) 43 .map(this.restExtractor.extractDataBool)
42 .catch((res) => this.restExtractor.handleError(res)); 44 .catch((res) => this.restExtractor.handleError(res));
43 } 45 }
46
47 signup(username: string, password: string, email: string) {
48 const body = {
49 username,
50 email,
51 password
52 };
53
54 return this.http.post(UserService.BASE_USERS_URL + 'register', body)
55 .map(this.restExtractor.extractDataBool)
56 .catch(this.restExtractor.handleError);
57 }
44} 58}