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

Fix login and navigation

parent fa3be002
No related merge requests found
......@@ -29,7 +29,6 @@ export class RoomJoinComponent implements OnInit {
room: Room;
demoId = '95680586';
user: User;
loggedIn: string;
roomFormControl = new FormControl('', [Validators.required, Validators.minLength(8)]);
......@@ -43,6 +42,7 @@ export class RoomJoinComponent implements OnInit {
}
ngOnInit() {
this.authenticationService.watchUser.subscribe(newUser => this.user = newUser);
}
getRoom(id: string): void {
......@@ -56,12 +56,12 @@ export class RoomJoinComponent implements OnInit {
} else {
if (!this.user) {
this.authenticationService.guestLogin(UserRole.PARTICIPANT).subscribe(loggedIn => {
this.loggedIn = loggedIn;
if (loggedIn === 'true') {
this.addAndNavigate();
}
});
}
if (this.loggedIn = 'true') {
this.roomService.addToHistory(this.room.id);
this.router.navigate([`/participant/room/${id}`]);
} else {
this.addAndNavigate();
}
}
});
......@@ -73,6 +73,11 @@ export class RoomJoinComponent implements OnInit {
}
}
addAndNavigate() {
this.roomService.addToHistory(this.room.id);
this.router.navigate([`/participant/room/${this.room.shortId}`]);
}
joinDemo(): void {
this.getRoom(this.demoId);
}
......
......@@ -75,7 +75,7 @@ export class RoomService extends BaseHttpService {
addToHistory(roomId: string): void {
const connectionUrl = `${ this.apiUrl.base + this.apiUrl.user }/${ this.authService.getUser().id }/roomHistory`;
this.http.post(connectionUrl, { roomId: roomId, lastVisit: this.joinDate.getTime() }, httpOptions).subscribe(r => console.log(r));
this.http.post(connectionUrl, { roomId: roomId, lastVisit: this.joinDate.getTime() }, httpOptions).subscribe();
}
updateRoom(updatedRoom: Room): Observable<Room> {
......
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