feat: Added a chatroom component, that is navigatable by the chatroom's ID
[demos/kafka/chat] / src / app / chatroom.service.ts
1 import { Injectable } from '@angular/core';
2 import { HttpClient } from "@angular/common/http";
3 import { Observable, of } from "rxjs";
4 import { Chatroom } from "./chatroom";
5
6 @Injectable({
7   providedIn: 'root'
8 })
9 export class ChatroomService {
10
11   private uriList = 'http://localhost:8080/list';
12   private uriGet = 'http://localhost:8080/get/';
13
14   constructor(private http: HttpClient) { }
15
16   getChatrooms(): Observable<Chatroom[]> {
17     return this.http.get<Chatroom[]>(this.uriList);
18   }
19
20   getChatroom(id: String): Observable<Chatroom> {
21     return this.http.get<Chatroom>(this.uriGet + id);
22   }
23 }