diff options
author | Chocobozzz <me@florianbigard.com> | 2017-12-29 19:10:13 +0100 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2017-12-29 19:10:13 +0100 |
commit | c5911fd347c76e8bdc05ea9f3ee9efed4a58c236 (patch) | |
tree | b8d287daca6c45305090cbec9da97d1155f275bd /client/src/app/core/auth/auth.service.ts | |
parent | 8b0d42ee372de6589796be26b83e5bffb1b69cdf (diff) | |
download | PeerTube-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.ts | 35 |
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' | |||
9 | import { Observable } from 'rxjs/Observable' | 9 | import { Observable } from 'rxjs/Observable' |
10 | import { ReplaySubject } from 'rxjs/ReplaySubject' | 10 | import { ReplaySubject } from 'rxjs/ReplaySubject' |
11 | import { Subject } from 'rxjs/Subject' | 11 | import { Subject } from 'rxjs/Subject' |
12 | import { OAuthClientLocal, User as UserServerModel, UserRefreshToken, UserRole, VideoChannel } from '../../../../../shared' | 12 | import { OAuthClientLocal, User as UserServerModel, UserRefreshToken } from '../../../../../shared' |
13 | import { Account } from '../../../../../shared/models/actors' | 13 | import { User } from '../../../../../shared/models/users' |
14 | import { UserLogin } from '../../../../../shared/models/users/user-login.model' | 14 | import { UserLogin } from '../../../../../shared/models/users/user-login.model' |
15 | import { environment } from '../../../environments/environment' | 15 | import { environment } from '../../../environments/environment' |
16 | import { RestExtractor } from '../../shared/rest' | 16 | import { RestExtractor } from '../../shared/rest' |
@@ -25,20 +25,7 @@ interface UserLoginWithUsername extends UserLogin { | |||
25 | username: string | 25 | username: string |
26 | } | 26 | } |
27 | 27 | ||
28 | interface UserLoginWithUserInformation extends UserLogin { | 28 | type 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() |
44 | export class AuthService { | 31 | export 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) { |