diff options
author | Chocobozzz <me@florianbigard.com> | 2019-03-12 11:40:42 +0100 |
---|---|---|
committer | Chocobozzz <chocobozzz@cpy.re> | 2019-03-18 11:17:59 +0100 |
commit | 15e9d5ca39e0b792f61453fbf3885a0fc446afa7 (patch) | |
tree | 015628bc7497f45477d287e8bb482e39d5d491e2 /client/src/app/shared/video-playlist | |
parent | c5a1ae500e68b759f76851552be6dd10631d34f4 (diff) | |
download | PeerTube-15e9d5ca39e0b792f61453fbf3885a0fc446afa7.tar.gz PeerTube-15e9d5ca39e0b792f61453fbf3885a0fc446afa7.tar.zst PeerTube-15e9d5ca39e0b792f61453fbf3885a0fc446afa7.zip |
Playlist reorder support
Diffstat (limited to 'client/src/app/shared/video-playlist')
-rw-r--r-- | client/src/app/shared/video-playlist/video-playlist.service.ts | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/client/src/app/shared/video-playlist/video-playlist.service.ts b/client/src/app/shared/video-playlist/video-playlist.service.ts index f7b37f83a..da7437507 100644 --- a/client/src/app/shared/video-playlist/video-playlist.service.ts +++ b/client/src/app/shared/video-playlist/video-playlist.service.ts | |||
@@ -17,6 +17,7 @@ import { AccountService } from '@app/shared/account/account.service' | |||
17 | import { Account } from '@app/shared/account/account.model' | 17 | import { Account } from '@app/shared/account/account.model' |
18 | import { RestService } from '@app/shared/rest' | 18 | import { RestService } from '@app/shared/rest' |
19 | import { VideoExistInPlaylist } from '@shared/models/videos/playlist/video-exist-in-playlist.model' | 19 | import { VideoExistInPlaylist } from '@shared/models/videos/playlist/video-exist-in-playlist.model' |
20 | import { VideoPlaylistReorder } from '@shared/models/videos/playlist/video-playlist-reorder.model' | ||
20 | 21 | ||
21 | @Injectable() | 22 | @Injectable() |
22 | export class VideoPlaylistService { | 23 | export class VideoPlaylistService { |
@@ -125,6 +126,19 @@ export class VideoPlaylistService { | |||
125 | ) | 126 | ) |
126 | } | 127 | } |
127 | 128 | ||
129 | reorderPlaylist (playlistId: number, oldPosition: number, newPosition: number) { | ||
130 | const body: VideoPlaylistReorder = { | ||
131 | startPosition: oldPosition, | ||
132 | insertAfterPosition: newPosition | ||
133 | } | ||
134 | |||
135 | return this.authHttp.post(VideoPlaylistService.BASE_VIDEO_PLAYLIST_URL + playlistId + '/videos/reorder', body) | ||
136 | .pipe( | ||
137 | map(this.restExtractor.extractDataBool), | ||
138 | catchError(err => this.restExtractor.handleError(err)) | ||
139 | ) | ||
140 | } | ||
141 | |||
128 | doesVideoExistInPlaylist (videoId: number) { | 142 | doesVideoExistInPlaylist (videoId: number) { |
129 | this.videoExistsInPlaylistSubject.next(videoId) | 143 | this.videoExistsInPlaylistSubject.next(videoId) |
130 | 144 | ||