aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/shared/video-channel
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2018-04-26 16:11:38 +0200
committerChocobozzz <me@florianbigard.com>2018-04-26 16:18:01 +0200
commit08c1efbe32244c321de28b0f2a6aaa3f99f46b58 (patch)
tree10a1b6c12f3e30a20f3d0dd66c698d9bae2aa41f /client/src/app/shared/video-channel
parent7de6afdf542da6968d3f412df9c3318ba19ad229 (diff)
downloadPeerTube-08c1efbe32244c321de28b0f2a6aaa3f99f46b58.tar.gz
PeerTube-08c1efbe32244c321de28b0f2a6aaa3f99f46b58.tar.zst
PeerTube-08c1efbe32244c321de28b0f2a6aaa3f99f46b58.zip
Add video channel management
Diffstat (limited to 'client/src/app/shared/video-channel')
-rw-r--r--client/src/app/shared/video-channel/video-channel.service.ts22
1 files changed, 21 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 d8efcc171..3533a0e9c 100644
--- a/client/src/app/shared/video-channel/video-channel.service.ts
+++ b/client/src/app/shared/video-channel/video-channel.service.ts
@@ -5,12 +5,14 @@ import { Observable } from 'rxjs/Observable'
5import { RestExtractor } from '../rest/rest-extractor.service' 5import { RestExtractor } from '../rest/rest-extractor.service'
6import { RestService } from '../rest/rest.service' 6import { RestService } from '../rest/rest.service'
7import { HttpClient } from '@angular/common/http' 7import { HttpClient } from '@angular/common/http'
8import { VideoChannel as VideoChannelServer } from '../../../../../shared/models/videos' 8import { VideoChannel as VideoChannelServer, VideoChannelCreate, VideoChannelUpdate } from '../../../../../shared/models/videos'
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' 12import { ReplaySubject } from 'rxjs/ReplaySubject'
13import { environment } from '../../../environments/environment' 13import { environment } from '../../../environments/environment'
14import { UserService } from '@app/+admin/users/shared/user.service'
15import { User } from '@app/shared'
14 16
15@Injectable() 17@Injectable()
16export class VideoChannelService { 18export class VideoChannelService {
@@ -37,6 +39,24 @@ export class VideoChannelService {
37 .catch((res) => this.restExtractor.handleError(res)) 39 .catch((res) => this.restExtractor.handleError(res))
38 } 40 }
39 41
42 createVideoChannel (videoChannel: VideoChannelCreate) {
43 return this.authHttp.post(VideoChannelService.BASE_VIDEO_CHANNEL_URL, videoChannel)
44 .map(this.restExtractor.extractDataBool)
45 .catch(err => this.restExtractor.handleError(err))
46 }
47
48 updateVideoChannel (videoChannelUUID: string, videoChannel: VideoChannelUpdate) {
49 return this.authHttp.put(VideoChannelService.BASE_VIDEO_CHANNEL_URL + videoChannelUUID, videoChannel)
50 .map(this.restExtractor.extractDataBool)
51 .catch(err => this.restExtractor.handleError(err))
52 }
53
54 removeVideoChannel (videoChannel: VideoChannel) {
55 return this.authHttp.delete(VideoChannelService.BASE_VIDEO_CHANNEL_URL + videoChannel.uuid)
56 .map(this.restExtractor.extractDataBool)
57 .catch(err => this.restExtractor.handleError(err))
58 }
59
40 private extractVideoChannels (result: ResultList<VideoChannelServer>) { 60 private extractVideoChannels (result: ResultList<VideoChannelServer>) {
41 const videoChannels: VideoChannel[] = [] 61 const videoChannels: VideoChannel[] = []
42 62