From 22a16e36f6526887ed8f5e5d3c9f9e5da0b4a8cd Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Tue, 21 Aug 2018 16:18:59 +0200 Subject: Add local user subscriptions --- .../shared/video-channel/video-channel.service.ts | 30 +++++++++++----------- 1 file changed, 15 insertions(+), 15 deletions(-) (limited to 'client/src/app/shared/video-channel') 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 510dc9c3d..46b121790 100644 --- a/client/src/app/shared/video-channel/video-channel.service.ts +++ b/client/src/app/shared/video-channel/video-channel.service.ts @@ -22,6 +22,16 @@ export class VideoChannelService { private restExtractor: RestExtractor ) {} + static extractVideoChannels (result: ResultList) { + const videoChannels: VideoChannel[] = [] + + for (const videoChannelJSON of result.data) { + videoChannels.push(new VideoChannel(videoChannelJSON)) + } + + return { data: videoChannels, total: result.total } + } + getVideoChannel (videoChannelName: string) { return this.authHttp.get(VideoChannelService.BASE_VIDEO_CHANNEL_URL + videoChannelName) .pipe( @@ -34,7 +44,7 @@ export class VideoChannelService { listAccountVideoChannels (account: Account): Observable> { return this.authHttp.get>(AccountService.BASE_ACCOUNT_URL + account.nameWithHost + '/video-channels') .pipe( - map(res => this.extractVideoChannels(res)), + map(res => VideoChannelService.extractVideoChannels(res)), catchError(err => this.restExtractor.handleError(err)) ) } @@ -47,16 +57,16 @@ export class VideoChannelService { ) } - updateVideoChannel (videoChannelUUID: string, videoChannel: VideoChannelUpdate) { - return this.authHttp.put(VideoChannelService.BASE_VIDEO_CHANNEL_URL + videoChannelUUID, videoChannel) + updateVideoChannel (videoChannelName: string, videoChannel: VideoChannelUpdate) { + return this.authHttp.put(VideoChannelService.BASE_VIDEO_CHANNEL_URL + videoChannelName, videoChannel) .pipe( map(this.restExtractor.extractDataBool), catchError(err => this.restExtractor.handleError(err)) ) } - changeVideoChannelAvatar (videoChannelUUID: string, avatarForm: FormData) { - const url = VideoChannelService.BASE_VIDEO_CHANNEL_URL + videoChannelUUID + '/avatar/pick' + changeVideoChannelAvatar (videoChannelName: string, avatarForm: FormData) { + const url = VideoChannelService.BASE_VIDEO_CHANNEL_URL + videoChannelName + '/avatar/pick' return this.authHttp.post<{ avatar: Avatar }>(url, avatarForm) .pipe(catchError(err => this.restExtractor.handleError(err))) @@ -69,14 +79,4 @@ export class VideoChannelService { catchError(err => this.restExtractor.handleError(err)) ) } - - private extractVideoChannels (result: ResultList) { - const videoChannels: VideoChannel[] = [] - - for (const videoChannelJSON of result.data) { - videoChannels.push(new VideoChannel(videoChannelJSON)) - } - - return { data: videoChannels, total: result.total } - } } -- cgit v1.2.3