From a184c71b526000f60f00649d260638723d426e6a Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Mon, 10 Apr 2017 20:29:33 +0200 Subject: Client: support signup --- client/src/app/shared/users/user.service.ts | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'client/src/app/shared') 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 @@ import { Injectable } from '@angular/core'; +import { Http } from '@angular/http'; import 'rxjs/add/operator/catch'; import 'rxjs/add/operator/map'; @@ -11,6 +12,7 @@ export class UserService { static BASE_USERS_URL = '/api/v1/users/'; constructor( + private http: Http, private authHttp: AuthHttp, private authService: AuthService, private restExtractor: RestExtractor @@ -41,4 +43,16 @@ export class UserService { .map(this.restExtractor.extractDataBool) .catch((res) => this.restExtractor.handleError(res)); } + + signup(username: string, password: string, email: string) { + const body = { + username, + email, + password + }; + + return this.http.post(UserService.BASE_USERS_URL + 'register', body) + .map(this.restExtractor.extractDataBool) + .catch(this.restExtractor.handleError); + } } -- cgit v1.2.3