aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/shared/users
diff options
context:
space:
mode:
authorChocobozzz <florian.bigard@gmail.com>2017-04-10 20:29:33 +0200
committerChocobozzz <florian.bigard@gmail.com>2017-04-10 20:29:33 +0200
commita184c71b526000f60f00649d260638723d426e6a (patch)
tree70fcb85cf5780519e59b4812167ce6f896d73afa /client/src/app/shared/users
parentc36b4ff77ebcd6cf3a71f0a5c8fb17fa0f4a0d24 (diff)
downloadPeerTube-a184c71b526000f60f00649d260638723d426e6a.tar.gz
PeerTube-a184c71b526000f60f00649d260638723d426e6a.tar.zst
PeerTube-a184c71b526000f60f00649d260638723d426e6a.zip
Client: support signup
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}