Skip to content
Snippets Groups Projects
Commit 048b16f4 authored by Heinrich Marks's avatar Heinrich Marks 🌺
Browse files

Adjust logic to show respective content list items only now

parent caf9f000
1 merge request!78Resolve "Content List Filter for Items"
Pipeline #13327 passed with stage
in 42 seconds
import { Component, OnInit } from '@angular/core';
import { ContentService } from '../content.service';
import { Content } from '../content';
import { ActivatedRoute } from '@angular/router';
import { RoomService } from '../room.service';
@Component({
selector: 'app-content-list',
......@@ -10,14 +12,27 @@ import { Content } from '../content';
export class ContentListComponent implements OnInit {
contents: Content[];
constructor(private contentService: ContentService) { }
constructor(
private contentService: ContentService,
private route: ActivatedRoute,
private roomService: RoomService,
) { }
ngOnInit() {
this.getContents();
this.route.params.subscribe(params => {
this.getRoom(params['roomId']);
});
}
getRoom(id: string): void {
this.roomService.getRoom(id).subscribe(
params => {
this.getContents(params['id']);
});
}
getContents(): void {
this.contentService.getContents()
getContents(roomId: string): void {
this.contentService.getContents(roomId)
.subscribe(contents => {
this.contents = contents;
});
......
......@@ -16,8 +16,9 @@ export class ContentService extends ErrorHandlingService {
super();
}
getContents(): Observable<Content[]> {
return this.http.get<Content[]>(this.contentUrl).pipe(
getContents(roomId: string): Observable<Content[]> {
const url = `${this.contentUrl}/?roomId=${roomId}`;
return this.http.get<Content[]>(url).pipe(
catchError(this.handleError('getContents', []))
);
}
......
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