aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/app.component.ts
diff options
context:
space:
mode:
Diffstat (limited to 'client/src/app/app.component.ts')
-rw-r--r--client/src/app/app.component.ts17
1 files changed, 16 insertions, 1 deletions
diff --git a/client/src/app/app.component.ts b/client/src/app/app.component.ts
index 95af89b19..a60138af9 100644
--- a/client/src/app/app.component.ts
+++ b/client/src/app/app.component.ts
@@ -14,7 +14,8 @@ import {
14 ScrollService, 14 ScrollService,
15 ServerService, 15 ServerService,
16 ThemeService, 16 ThemeService,
17 User 17 User,
18 UserLocalStorageService
18} from '@app/core' 19} from '@app/core'
19import { HooksService } from '@app/core/plugins/hooks.service' 20import { HooksService } from '@app/core/plugins/hooks.service'
20import { PluginService } from '@app/core/plugins/plugin.service' 21import { PluginService } from '@app/core/plugins/plugin.service'
@@ -70,6 +71,7 @@ export class AppComponent implements OnInit, AfterViewInit {
70 private ngbConfig: NgbConfig, 71 private ngbConfig: NgbConfig,
71 private loadingBar: LoadingBarService, 72 private loadingBar: LoadingBarService,
72 private scrollService: ScrollService, 73 private scrollService: ScrollService,
74 private userLocalStorage: UserLocalStorageService,
73 public menu: MenuService 75 public menu: MenuService
74 ) { 76 ) {
75 this.ngbConfig.animation = false 77 this.ngbConfig.animation = false
@@ -86,6 +88,8 @@ export class AppComponent implements OnInit, AfterViewInit {
86 ngOnInit () { 88 ngOnInit () {
87 document.getElementById('incompatible-browser').className += ' browser-ok' 89 document.getElementById('incompatible-browser').className += ' browser-ok'
88 90
91 this.loadUser()
92
89 this.serverConfig = this.serverService.getHTMLConfig() 93 this.serverConfig = this.serverService.getHTMLConfig()
90 94
91 this.hooks.runAction('action:application.init', 'common') 95 this.hooks.runAction('action:application.init', 'common')
@@ -300,4 +304,15 @@ export class AppComponent implements OnInit, AfterViewInit {
300 }, undefined, $localize`Go to the videos upload page`) 304 }, undefined, $localize`Go to the videos upload page`)
301 ]) 305 ])
302 } 306 }
307
308 private loadUser () {
309 const tokens = this.userLocalStorage.getTokens()
310 if (!tokens) return
311
312 const user = this.userLocalStorage.getLoggedInUser()
313 if (!user) return
314
315 // Initialize user
316 this.authService.buildAuthUser(user, tokens)
317 }
303} 318}