From d044accf5eb6c3c05f95b642e9f1c0c8afb55a52 Mon Sep 17 00:00:00 2001 From: Bnyro Date: Fri, 16 Jun 2023 08:39:44 +0200 Subject: [PATCH] Fix removing videos from local playlist --- src/components/VideoItem.vue | 2 +- src/main.js | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/components/VideoItem.vue b/src/components/VideoItem.vue index dd6ba219..e05e3992 100644 --- a/src/components/VideoItem.vue +++ b/src/components/VideoItem.vue @@ -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"); }); diff --git a/src/main.js b/src/main.js index e6d25c50..22f60614 100644 --- a/src/main.js +++ b/src/main.js @@ -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);