From 170726f523ff48f89da45473fc53ca54784f43dd Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Wed, 25 Apr 2018 16:56:13 +0200 Subject: Implement video channel views --- .../src/app/shared/video-channel/video-channel.service.ts | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'client/src/app/shared/video-channel/video-channel.service.ts') diff --git a/client/src/app/shared/video-channel/video-channel.service.ts b/client/src/app/shared/video-channel/video-channel.service.ts index 1f9088c38..d8efcc171 100644 --- a/client/src/app/shared/video-channel/video-channel.service.ts +++ b/client/src/app/shared/video-channel/video-channel.service.ts @@ -9,16 +9,29 @@ import { VideoChannel as VideoChannelServer } from '../../../../../shared/models import { AccountService } from '../account/account.service' import { ResultList } from '../../../../../shared' import { VideoChannel } from './video-channel.model' +import { ReplaySubject } from 'rxjs/ReplaySubject' +import { environment } from '../../../environments/environment' @Injectable() export class VideoChannelService { + static BASE_VIDEO_CHANNEL_URL = environment.apiUrl + '/api/v1/video-channels/' + + videoChannelLoaded = new ReplaySubject(1) + constructor ( private authHttp: HttpClient, private restExtractor: RestExtractor, private restService: RestService ) {} - getVideoChannels (accountId: number): Observable> { + getVideoChannel (videoChannelUUID: string) { + return this.authHttp.get(VideoChannelService.BASE_VIDEO_CHANNEL_URL + videoChannelUUID) + .map(videoChannelHash => new VideoChannel(videoChannelHash)) + .do(videoChannel => this.videoChannelLoaded.next(videoChannel)) + .catch((res) => this.restExtractor.handleError(res)) + } + + listAccountVideoChannels (accountId: number): Observable> { return this.authHttp.get>(AccountService.BASE_ACCOUNT_URL + accountId + '/video-channels') .map(res => this.extractVideoChannels(res)) .catch((res) => this.restExtractor.handleError(res)) -- cgit v1.2.3