aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/shared/users
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2017-12-29 19:10:13 +0100
committerChocobozzz <me@florianbigard.com>2017-12-29 19:10:13 +0100
commitc5911fd347c76e8bdc05ea9f3ee9efed4a58c236 (patch)
treeb8d287daca6c45305090cbec9da97d1155f275bd /client/src/app/shared/users
parent8b0d42ee372de6589796be26b83e5bffb1b69cdf (diff)
downloadPeerTube-c5911fd347c76e8bdc05ea9f3ee9efed4a58c236.tar.gz
PeerTube-c5911fd347c76e8bdc05ea9f3ee9efed4a58c236.tar.zst
PeerTube-c5911fd347c76e8bdc05ea9f3ee9efed4a58c236.zip
Begin to add avatar to actors
Diffstat (limited to 'client/src/app/shared/users')
-rw-r--r--client/src/app/shared/users/user.model.ts4
-rw-r--r--client/src/app/shared/users/user.service.ts16
2 files changed, 18 insertions, 2 deletions
diff --git a/client/src/app/shared/users/user.model.ts b/client/src/app/shared/users/user.model.ts
index 7a962ae3e..83aae4463 100644
--- a/client/src/app/shared/users/user.model.ts
+++ b/client/src/app/shared/users/user.model.ts
@@ -57,7 +57,7 @@ export class User implements UserServerModel {
57 return hasUserRight(this.role, right) 57 return hasUserRight(this.role, right)
58 } 58 }
59 59
60 getAvatarPath () { 60 getAvatarUrl () {
61 return Account.GET_ACCOUNT_AVATAR_PATH(this.account) 61 return Account.GET_ACCOUNT_AVATAR_URL(this.account)
62 } 62 }
63} 63}
diff --git a/client/src/app/shared/users/user.service.ts b/client/src/app/shared/users/user.service.ts
index d97edbcbe..58ddaa5ee 100644
--- a/client/src/app/shared/users/user.service.ts
+++ b/client/src/app/shared/users/user.service.ts
@@ -5,6 +5,7 @@ import 'rxjs/add/operator/map'
5import { UserCreate, UserUpdateMe } from '../../../../../shared' 5import { UserCreate, UserUpdateMe } from '../../../../../shared'
6import { environment } from '../../../environments/environment' 6import { environment } from '../../../environments/environment'
7import { RestExtractor } from '../rest' 7import { RestExtractor } from '../rest'
8import { User } from './user.model'
8 9
9@Injectable() 10@Injectable()
10export class UserService { 11export class UserService {
@@ -34,9 +35,24 @@ export class UserService {
34 .catch(res => this.restExtractor.handleError(res)) 35 .catch(res => this.restExtractor.handleError(res))
35 } 36 }
36 37
38 changeAvatar (avatarForm: FormData) {
39 const url = UserService.BASE_USERS_URL + 'me/avatar/pick'
40
41 return this.authHttp.post(url, avatarForm)
42 .catch(this.restExtractor.handleError)
43 }
44
37 signup (userCreate: UserCreate) { 45 signup (userCreate: UserCreate) {
38 return this.authHttp.post(UserService.BASE_USERS_URL + 'register', userCreate) 46 return this.authHttp.post(UserService.BASE_USERS_URL + 'register', userCreate)
39 .map(this.restExtractor.extractDataBool) 47 .map(this.restExtractor.extractDataBool)
40 .catch(res => this.restExtractor.handleError(res)) 48 .catch(res => this.restExtractor.handleError(res))
41 } 49 }
50
51 getMyInformation () {
52 const url = UserService.BASE_USERS_URL + 'me'
53
54 return this.authHttp.get(url)
55 .map((userHash: any) => new User(userHash))
56 .catch(res => this.restExtractor.handleError(res))
57 }
42} 58}