- makeFriends() {
- this.friendService.makeFriends().subscribe(
- status => {
- if (status === 409) {
- alert('Already made friends!');
- } else {
- alert('Made friends!');
+ ngOnInit () {
+ this.authService.loadClientCredentials()
+
+ if (this.authService.isLoggedIn()) {
+ // The service will automatically redirect to the login page if the token is not valid anymore
+ this.authService.refreshUserInformation()
+ }
+
+ // Load custom data from server
+ this.serverService.loadConfig()
+ this.serverService.loadVideoCategories()
+ this.serverService.loadVideoLanguages()
+ this.serverService.loadVideoLicences()
+ this.serverService.loadVideoPrivacies()
+
+ // Do not display menu on small screens
+ if (isInSmallView()) {
+ this.isMenuDisplayed = false
+ }
+
+ this.router.events.subscribe(
+ e => {
+ // User clicked on a link in the menu, change the page
+ if (e instanceof GuardsCheckStart && isInSmallView()) {
+ this.isMenuDisplayed = false