diff options
author | Chocobozzz <me@florianbigard.com> | 2018-08-21 16:18:59 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2018-08-27 09:41:54 +0200 |
commit | 22a16e36f6526887ed8f5e5d3c9f9e5da0b4a8cd (patch) | |
tree | 93c53e0619f966bd9ff1bb698c411277a9447a41 /client/src/app/shared/video-channel | |
parent | 99492dbc0d87ef54d0dab7d8d44f8d0de5722bdd (diff) | |
download | PeerTube-22a16e36f6526887ed8f5e5d3c9f9e5da0b4a8cd.tar.gz PeerTube-22a16e36f6526887ed8f5e5d3c9f9e5da0b4a8cd.tar.zst PeerTube-22a16e36f6526887ed8f5e5d3c9f9e5da0b4a8cd.zip |
Add local user subscriptions
Diffstat (limited to 'client/src/app/shared/video-channel')
-rw-r--r-- | client/src/app/shared/video-channel/video-channel.service.ts | 30 |
1 files changed, 15 insertions, 15 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 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 { | |||
22 | private restExtractor: RestExtractor | 22 | private restExtractor: RestExtractor |
23 | ) {} | 23 | ) {} |
24 | 24 | ||
25 | static extractVideoChannels (result: ResultList<VideoChannelServer>) { | ||
26 | const videoChannels: VideoChannel[] = [] | ||
27 | |||
28 | for (const videoChannelJSON of result.data) { | ||
29 | videoChannels.push(new VideoChannel(videoChannelJSON)) | ||
30 | } | ||
31 | |||
32 | return { data: videoChannels, total: result.total } | ||
33 | } | ||
34 | |||
25 | getVideoChannel (videoChannelName: string) { | 35 | getVideoChannel (videoChannelName: string) { |
26 | return this.authHttp.get<VideoChannel>(VideoChannelService.BASE_VIDEO_CHANNEL_URL + videoChannelName) | 36 | return this.authHttp.get<VideoChannel>(VideoChannelService.BASE_VIDEO_CHANNEL_URL + videoChannelName) |
27 | .pipe( | 37 | .pipe( |
@@ -34,7 +44,7 @@ export class VideoChannelService { | |||
34 | listAccountVideoChannels (account: Account): Observable<ResultList<VideoChannel>> { | 44 | listAccountVideoChannels (account: Account): Observable<ResultList<VideoChannel>> { |
35 | return this.authHttp.get<ResultList<VideoChannelServer>>(AccountService.BASE_ACCOUNT_URL + account.nameWithHost + '/video-channels') | 45 | return this.authHttp.get<ResultList<VideoChannelServer>>(AccountService.BASE_ACCOUNT_URL + account.nameWithHost + '/video-channels') |
36 | .pipe( | 46 | .pipe( |
37 | map(res => this.extractVideoChannels(res)), | 47 | map(res => VideoChannelService.extractVideoChannels(res)), |
38 | catchError(err => this.restExtractor.handleError(err)) | 48 | catchError(err => this.restExtractor.handleError(err)) |
39 | ) | 49 | ) |
40 | } | 50 | } |
@@ -47,16 +57,16 @@ export class VideoChannelService { | |||
47 | ) | 57 | ) |
48 | } | 58 | } |
49 | 59 | ||
50 | updateVideoChannel (videoChannelUUID: string, videoChannel: VideoChannelUpdate) { | 60 | updateVideoChannel (videoChannelName: string, videoChannel: VideoChannelUpdate) { |
51 | return this.authHttp.put(VideoChannelService.BASE_VIDEO_CHANNEL_URL + videoChannelUUID, videoChannel) | 61 | return this.authHttp.put(VideoChannelService.BASE_VIDEO_CHANNEL_URL + videoChannelName, videoChannel) |
52 | .pipe( | 62 | .pipe( |
53 | map(this.restExtractor.extractDataBool), | 63 | map(this.restExtractor.extractDataBool), |
54 | catchError(err => this.restExtractor.handleError(err)) | 64 | catchError(err => this.restExtractor.handleError(err)) |
55 | ) | 65 | ) |
56 | } | 66 | } |
57 | 67 | ||
58 | changeVideoChannelAvatar (videoChannelUUID: string, avatarForm: FormData) { | 68 | changeVideoChannelAvatar (videoChannelName: string, avatarForm: FormData) { |
59 | const url = VideoChannelService.BASE_VIDEO_CHANNEL_URL + videoChannelUUID + '/avatar/pick' | 69 | const url = VideoChannelService.BASE_VIDEO_CHANNEL_URL + videoChannelName + '/avatar/pick' |
60 | 70 | ||
61 | return this.authHttp.post<{ avatar: Avatar }>(url, avatarForm) | 71 | return this.authHttp.post<{ avatar: Avatar }>(url, avatarForm) |
62 | .pipe(catchError(err => this.restExtractor.handleError(err))) | 72 | .pipe(catchError(err => this.restExtractor.handleError(err))) |
@@ -69,14 +79,4 @@ export class VideoChannelService { | |||
69 | catchError(err => this.restExtractor.handleError(err)) | 79 | catchError(err => this.restExtractor.handleError(err)) |
70 | ) | 80 | ) |
71 | } | 81 | } |
72 | |||
73 | private extractVideoChannels (result: ResultList<VideoChannelServer>) { | ||
74 | const videoChannels: VideoChannel[] = [] | ||
75 | |||
76 | for (const videoChannelJSON of result.data) { | ||
77 | videoChannels.push(new VideoChannel(videoChannelJSON)) | ||
78 | } | ||
79 | |||
80 | return { data: videoChannels, total: result.total } | ||
81 | } | ||
82 | } | 82 | } |