aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/core/auth/auth.service.ts
diff options
context:
space:
mode:
Diffstat (limited to 'client/src/app/core/auth/auth.service.ts')
-rw-r--r--client/src/app/core/auth/auth.service.ts21
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'
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'
17import { UserConstructorHash } from '../../shared/users/user.model'
18import { AuthStatus } from './auth-status.model' 17import { AuthStatus } from './auth-status.model'
19import { AuthUser } from './auth-user.model' 18import { 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)