diff options
author | Chocobozzz <me@florianbigard.com> | 2018-01-08 12:53:09 +0100 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2018-01-08 12:53:09 +0100 |
commit | ce5496d6a31b9617aba67970f5dc135e73335234 (patch) | |
tree | b5d2578f4618b71632e92838c3ceae36aa102798 /client/src/app/core/auth/auth.service.ts | |
parent | 108af66140713c4beec681a71d360ab788226528 (diff) | |
download | PeerTube-ce5496d6a31b9617aba67970f5dc135e73335234.tar.gz PeerTube-ce5496d6a31b9617aba67970f5dc135e73335234.tar.zst PeerTube-ce5496d6a31b9617aba67970f5dc135e73335234.zip |
Support video quota on client
Diffstat (limited to 'client/src/app/core/auth/auth.service.ts')
-rw-r--r-- | client/src/app/core/auth/auth.service.ts | 21 |
1 files changed, 2 insertions, 19 deletions
diff --git a/client/src/app/core/auth/auth.service.ts b/client/src/app/core/auth/auth.service.ts index 8a2ba77d6..8700e8c74 100644 --- a/client/src/app/core/auth/auth.service.ts +++ b/client/src/app/core/auth/auth.service.ts | |||
@@ -14,7 +14,6 @@ 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' |
17 | import { UserConstructorHash } from '../../shared/users/user.model' | ||
18 | import { AuthStatus } from './auth-status.model' | 17 | import { AuthStatus } from './auth-status.model' |
19 | import { AuthUser } from './auth-user.model' | 18 | import { AuthUser } from './auth-user.model' |
20 | 19 | ||
@@ -178,12 +177,7 @@ export class AuthService { | |||
178 | this.mergeUserInformation(obj) | 177 | this.mergeUserInformation(obj) |
179 | .subscribe( | 178 | .subscribe( |
180 | res => { | 179 | res => { |
181 | this.user.displayNSFW = res.displayNSFW | 180 | this.user.patch(res) |
182 | this.user.autoPlayVideo = res.autoPlayVideo | ||
183 | this.user.role = res.role | ||
184 | this.user.videoChannels = res.videoChannels | ||
185 | this.user.account = res.account | ||
186 | |||
187 | this.user.save() | 181 | this.user.save() |
188 | 182 | ||
189 | this.userInformationLoaded.next(true) | 183 | this.userInformationLoaded.next(true) |
@@ -200,24 +194,13 @@ export class AuthService { | |||
200 | } | 194 | } |
201 | 195 | ||
202 | private handleLogin (obj: UserLoginWithUserInformation) { | 196 | private handleLogin (obj: UserLoginWithUserInformation) { |
203 | const hashUser: UserConstructorHash = { | ||
204 | id: obj.id, | ||
205 | username: obj.username, | ||
206 | role: obj.role, | ||
207 | email: obj.email, | ||
208 | displayNSFW: obj.displayNSFW, | ||
209 | autoPlayVideo: obj.autoPlayVideo, | ||
210 | videoQuota: obj.videoQuota, | ||
211 | videoChannels: obj.videoChannels, | ||
212 | account: obj.account | ||
213 | } | ||
214 | const hashTokens = { | 197 | const hashTokens = { |
215 | accessToken: obj.access_token, | 198 | accessToken: obj.access_token, |
216 | tokenType: obj.token_type, | 199 | tokenType: obj.token_type, |
217 | refreshToken: obj.refresh_token | 200 | refreshToken: obj.refresh_token |
218 | } | 201 | } |
219 | 202 | ||
220 | this.user = new AuthUser(hashUser, hashTokens) | 203 | this.user = new AuthUser(obj, hashTokens) |
221 | this.user.save() | 204 | this.user.save() |
222 | 205 | ||
223 | this.setStatus(AuthStatus.LoggedIn) | 206 | this.setStatus(AuthStatus.LoggedIn) |