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({
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 {