diff options
author | Chocobozzz <me@florianbigard.com> | 2018-04-26 16:11:38 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2018-04-26 16:18:01 +0200 |
commit | 08c1efbe32244c321de28b0f2a6aaa3f99f46b58 (patch) | |
tree | 10a1b6c12f3e30a20f3d0dd66c698d9bae2aa41f /client/src/app/shared/video-channel | |
parent | 7de6afdf542da6968d3f412df9c3318ba19ad229 (diff) | |
download | PeerTube-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.ts | 22 |
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' | |||
5 | import { RestExtractor } from '../rest/rest-extractor.service' | 5 | import { RestExtractor } from '../rest/rest-extractor.service' |
6 | import { RestService } from '../rest/rest.service' | 6 | import { RestService } from '../rest/rest.service' |
7 | import { HttpClient } from '@angular/common/http' | 7 | import { HttpClient } from '@angular/common/http' |
8 | import { VideoChannel as VideoChannelServer } from '../../../../../shared/models/videos' | 8 | import { VideoChannel as VideoChannelServer, VideoChannelCreate, VideoChannelUpdate } from '../../../../../shared/models/videos' |
9 | import { AccountService } from '../account/account.service' | 9 | import { AccountService } from '../account/account.service' |
10 | import { ResultList } from '../../../../../shared' | 10 | import { ResultList } from '../../../../../shared' |
11 | import { VideoChannel } from './video-channel.model' | 11 | import { VideoChannel } from './video-channel.model' |
12 | import { ReplaySubject } from 'rxjs/ReplaySubject' | 12 | import { ReplaySubject } from 'rxjs/ReplaySubject' |
13 | import { environment } from '../../../environments/environment' | 13 | import { environment } from '../../../environments/environment' |
14 | import { UserService } from '@app/+admin/users/shared/user.service' | ||
15 | import { User } from '@app/shared' | ||
14 | 16 | ||
15 | @Injectable() | 17 | @Injectable() |
16 | export class VideoChannelService { | 18 | export 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 | ||