aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/shared/video-channel
diff options
context:
space:
mode:
Diffstat (limited to 'client/src/app/shared/video-channel')
-rw-r--r--client/src/app/shared/video-channel/video-channel.service.ts15
1 files changed, 14 insertions, 1 deletions
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
9import { AccountService } from '../account/account.service' 9import { AccountService } from '../account/account.service'
10import { ResultList } from '../../../../../shared' 10import { ResultList } from '../../../../../shared'
11import { VideoChannel } from './video-channel.model' 11import { VideoChannel } from './video-channel.model'
12import { ReplaySubject } from 'rxjs/ReplaySubject'
13import { environment } from '../../../environments/environment'
12 14
13@Injectable() 15@Injectable()
14export class VideoChannelService { 16export class VideoChannelService {
17 static BASE_VIDEO_CHANNEL_URL = environment.apiUrl + '/api/v1/video-channels/'
18
19 videoChannelLoaded = new ReplaySubject<VideoChannel>(1)
20
15 constructor ( 21 constructor (
16 private authHttp: HttpClient, 22 private authHttp: HttpClient,
17 private restExtractor: RestExtractor, 23 private restExtractor: RestExtractor,
18 private restService: RestService 24 private restService: RestService
19 ) {} 25 ) {}
20 26
21 getVideoChannels (accountId: number): Observable<ResultList<VideoChannel>> { 27 getVideoChannel (videoChannelUUID: string) {
28 return this.authHttp.get<VideoChannel>(VideoChannelService.BASE_VIDEO_CHANNEL_URL + videoChannelUUID)
29 .map(videoChannelHash => new VideoChannel(videoChannelHash))
30 .do(videoChannel => this.videoChannelLoaded.next(videoChannel))
31 .catch((res) => this.restExtractor.handleError(res))
32 }
33
34 listAccountVideoChannels (accountId: number): Observable<ResultList<VideoChannel>> {
22 return this.authHttp.get<ResultList<VideoChannelServer>>(AccountService.BASE_ACCOUNT_URL + accountId + '/video-channels') 35 return this.authHttp.get<ResultList<VideoChannelServer>>(AccountService.BASE_ACCOUNT_URL + accountId + '/video-channels')
23 .map(res => this.extractVideoChannels(res)) 36 .map(res => this.extractVideoChannels(res))
24 .catch((res) => this.restExtractor.handleError(res)) 37 .catch((res) => this.restExtractor.handleError(res))