Skip to content
Snippets Groups Projects
Commit 27a75ab2 authored by Lukas Mauß's avatar Lukas Mauß
Browse files

Add new function to landing-page which decides if you have to loding or can create session

parent 996265d3
No related merge requests found
<div fxLayout="column" fxLayoutAlign="center center" fxlayoutgap="50px" fxFill>
<app-room-join></app-room-join>
<button mat-fab class="fab-extended" color="accent" (click)="openLoginDialog()">
<button mat-fab class="fab-extended" color="accent" (click)="createSession()">
<mat-icon class="add">add</mat-icon>
Create Session
</button>
......
......@@ -5,6 +5,8 @@ import { Router } from '@angular/router';
import { TranslateService } from '@ngx-translate/core';
import { LanguageService } from '../../../services/util/language.service';
import { LoginPageComponent } from '../login-page/login-page.component';
import { AuthenticationService } from '../../../services/http/authentication.service';
import { User } from '../../../models/user';
@Component({
selector: 'app-new-landing',
......@@ -13,15 +15,27 @@ import { LoginPageComponent } from '../login-page/login-page.component';
})
export class NewLandingComponent implements OnInit {
user: User;
constructor(private router: Router,
public dialog: MatDialog,
private translateService: TranslateService,
protected langService: LanguageService) {
protected langService: LanguageService,
public authenticationService: AuthenticationService) {
langService.langEmitter.subscribe(lang => translateService.use(lang));
}
ngOnInit() {
this.translateService.use(localStorage.getItem('currentLang'));
this.authenticationService.watchUser.subscribe(newUser => this.user = newUser);
}
createSession() {
if (this.user) {
this.openCreateRoomDialog();
} else {
this.openLoginDialog();
}
}
openCreateRoomDialog(): void {
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment