feat: Added a chatroom component, that is navigatable by the chatroom's ID
[demos/kafka/chat] / src / app / chatrooms / chatrooms.component.ts
index c965cf9..26665da 100644 (file)
@@ -1,6 +1,6 @@
 import { Component, OnInit } from '@angular/core';
-import { FormsModule } from '@angular/forms';
 import { Chatroom } from '../chatroom';
+import { UserService } from "../user.service";
 import { ChatroomService } from "../chatroom.service";
 
 @Component({
@@ -8,15 +8,17 @@ import { ChatroomService } from "../chatroom.service";
   templateUrl: './chatrooms.component.html',
   styleUrls: ['./chatrooms.component.less']
 })
-export class ChatroomsComponent  implements OnInit
+export class ChatroomsComponent implements OnInit
 {
   chatrooms: Chatroom[] = [];
 
-  constructor(private chatroomsService: ChatroomService) { }
+  constructor(
+    private chatroomsService: ChatroomService,
+    private userService: UserService) {}
 
   ngOnInit(): void
   {
-    this.getChatrooms();
+    this.userService.assertUserisKnown(() => this.getChatrooms());
   }
 
   getChatrooms(): void {