Fix reordering playlist
This commit is contained in:
parent
1c8ddbfaa0
commit
b767c4a74a
|
@ -67,7 +67,9 @@ export class MyAccountVideoPlaylistElementsComponent implements OnInit, OnDestro
|
||||||
if (previousIndex === newIndex) return
|
if (previousIndex === newIndex) return
|
||||||
|
|
||||||
const oldPosition = this.videos[previousIndex].playlistElement.position
|
const oldPosition = this.videos[previousIndex].playlistElement.position
|
||||||
const insertAfter = newIndex === 0 ? 0 : this.videos[newIndex].playlistElement.position
|
let insertAfter = this.videos[newIndex].playlistElement.position
|
||||||
|
|
||||||
|
if (oldPosition > insertAfter) insertAfter--
|
||||||
|
|
||||||
this.videoPlaylistService.reorderPlaylist(this.playlist.id, oldPosition, insertAfter)
|
this.videoPlaylistService.reorderPlaylist(this.playlist.id, oldPosition, insertAfter)
|
||||||
.subscribe(
|
.subscribe(
|
||||||
|
|
Loading…
Reference in New Issue