ScrollService,
ServerService,
ThemeService,
- User
+ User,
+ UserLocalStorageService
} from '@app/core'
import { HooksService } from '@app/core/plugins/hooks.service'
import { PluginService } from '@app/core/plugins/plugin.service'
import { MenuService } from './core/menu/menu.service'
import { POP_STATE_MODAL_DISMISS } from './helpers'
import { InstanceService } from './shared/shared-instance'
+import { GlobalIconName } from './shared/shared-icons'
@Component({
selector: 'my-app',
private ngbConfig: NgbConfig,
private loadingBar: LoadingBarService,
private scrollService: ScrollService,
+ private userLocalStorage: UserLocalStorageService,
public menu: MenuService
) {
this.ngbConfig.animation = false
ngOnInit () {
document.getElementById('incompatible-browser').className += ' browser-ok'
+ this.loadUser()
+
this.serverConfig = this.serverService.getHTMLConfig()
this.hooks.runAction('action:application.init', 'common')
this.screenService.isBroadcastMessageDisplayed = false
}
+ getNotificationIcon (message: { severity: 'success' | 'error' | 'info' }): GlobalIconName {
+ switch (message.severity) {
+ case 'error':
+ return 'cross'
+ case 'success':
+ return 'tick'
+ case 'info':
+ return 'help'
+ }
+ }
+
private initRouteEvents () {
const eventsObs = this.router.events
}, undefined, $localize`Go to the videos upload page`)
])
}
+
+ private loadUser () {
+ const tokens = this.userLocalStorage.getTokens()
+ if (!tokens) return
+
+ const user = this.userLocalStorage.getLoggedInUser()
+ if (!user) return
+
+ // Initialize user
+ this.authService.buildAuthUser(user, tokens)
+ }
}