aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/core/auth/auth.service.ts
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/core/auth/auth.service.ts
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/core/auth/auth.service.ts')
-rw-r--r--client/src/app/core/auth/auth.service.ts35
1 files changed, 4 insertions, 31 deletions
diff --git a/client/src/app/core/auth/auth.service.ts b/client/src/app/core/auth/auth.service.ts
index c914848ae..8a2ba77d6 100644
--- a/client/src/app/core/auth/auth.service.ts
+++ b/client/src/app/core/auth/auth.service.ts
@@ -9,8 +9,8 @@ import 'rxjs/add/operator/mergeMap'
9import { Observable } from 'rxjs/Observable' 9import { Observable } from 'rxjs/Observable'
10import { ReplaySubject } from 'rxjs/ReplaySubject' 10import { ReplaySubject } from 'rxjs/ReplaySubject'
11import { Subject } from 'rxjs/Subject' 11import { Subject } from 'rxjs/Subject'
12import { OAuthClientLocal, User as UserServerModel, UserRefreshToken, UserRole, VideoChannel } from '../../../../../shared' 12import { OAuthClientLocal, User as UserServerModel, UserRefreshToken } from '../../../../../shared'
13import { Account } from '../../../../../shared/models/actors' 13import { User } from '../../../../../shared/models/users'
14import { UserLogin } from '../../../../../shared/models/users/user-login.model' 14import { UserLogin } from '../../../../../shared/models/users/user-login.model'
15import { environment } from '../../../environments/environment' 15import { environment } from '../../../environments/environment'
16import { RestExtractor } from '../../shared/rest' 16import { RestExtractor } from '../../shared/rest'
@@ -25,20 +25,7 @@ interface UserLoginWithUsername extends UserLogin {
25 username: string 25 username: string
26} 26}
27 27
28interface UserLoginWithUserInformation extends UserLogin { 28type UserLoginWithUserInformation = UserLoginWithUsername & User
29 access_token: string
30 refresh_token: string
31 token_type: string
32 username: string
33 id: number
34 role: UserRole
35 displayNSFW: boolean
36 autoPlayVideo: boolean
37 email: string
38 videoQuota: number
39 account: Account
40 videoChannels: VideoChannel[]
41}
42 29
43@Injectable() 30@Injectable()
44export class AuthService { 31export class AuthService {
@@ -209,21 +196,7 @@ export class AuthService {
209 const headers = new HttpHeaders().set('Authorization', `${obj.token_type} ${obj.access_token}`) 196 const headers = new HttpHeaders().set('Authorization', `${obj.token_type} ${obj.access_token}`)
210 197
211 return this.http.get<UserServerModel>(AuthService.BASE_USER_INFORMATION_URL, { headers }) 198 return this.http.get<UserServerModel>(AuthService.BASE_USER_INFORMATION_URL, { headers })
212 .map(res => { 199 .map(res => Object.assign(obj, res))
213 const newProperties = {
214 id: res.id,
215 role: res.role,
216 displayNSFW: res.displayNSFW,
217 autoPlayVideo: res.autoPlayVideo,
218 email: res.email,
219 videoQuota: res.videoQuota,
220 account: res.account,
221 videoChannels: res.videoChannels
222 }
223
224 return Object.assign(obj, newProperties)
225 }
226 )
227 } 200 }
228 201
229 private handleLogin (obj: UserLoginWithUserInformation) { 202 private handleLogin (obj: UserLoginWithUserInformation) {