feat: A Username must not be empty
[demos/kafka/chat] / src / app / chatrooms / chatrooms.component.ts
index c965cf9..99eb15a 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({
@@ -12,11 +12,13 @@ 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 {