Fix removing videos from local playlist

This commit is contained in:
Bnyro 2023-06-16 08:39:44 +02:00
parent f854af3581
commit d044accf5e
2 changed files with 3 additions and 3 deletions

View File

@ -177,7 +177,7 @@ export default {
methods: {
removeVideo() {
this.$refs.removeButton.disabled = true;
this.removeVideoFromPlaylist(this.playlistId, null, this.index).then(json => {
this.removeVideoFromPlaylist(this.playlistId, this.index).then(json => {
if (json.error) alert(json.error);
else this.$emit("remove");
});

View File

@ -518,11 +518,11 @@ const mixin = {
},
});
},
async removeVideoFromPlaylist(playlistId, videoId, index) {
async removeVideoFromPlaylist(playlistId, index) {
if (!this.authenticated) {
const playlist = await this.getLocalPlaylist(playlistId);
const videoIds = JSON.parse(playlist.videoIds);
videoIds.splice(videoIds.indexOf(videoId), 1);
videoIds.splice(index, 1);
playlist.videoIds = JSON.stringify(videoIds);
if (videoIds.length == 0) playlist.thumbnail = "https://pipedproxy.kavin.rocks/?host=i.ytimg.com";
this.createOrUpdateLocalPlaylist(playlist);