mirror of
https://github.com/TeamPiped/Piped.git
synced 2024-11-26 15:37:24 +00:00
Fix removing videos from local playlist
This commit is contained in:
parent
f854af3581
commit
d044accf5e
@ -177,7 +177,7 @@ export default {
|
|||||||
methods: {
|
methods: {
|
||||||
removeVideo() {
|
removeVideo() {
|
||||||
this.$refs.removeButton.disabled = true;
|
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);
|
if (json.error) alert(json.error);
|
||||||
else this.$emit("remove");
|
else this.$emit("remove");
|
||||||
});
|
});
|
||||||
|
@ -518,11 +518,11 @@ const mixin = {
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
async removeVideoFromPlaylist(playlistId, videoId, index) {
|
async removeVideoFromPlaylist(playlistId, index) {
|
||||||
if (!this.authenticated) {
|
if (!this.authenticated) {
|
||||||
const playlist = await this.getLocalPlaylist(playlistId);
|
const playlist = await this.getLocalPlaylist(playlistId);
|
||||||
const videoIds = JSON.parse(playlist.videoIds);
|
const videoIds = JSON.parse(playlist.videoIds);
|
||||||
videoIds.splice(videoIds.indexOf(videoId), 1);
|
videoIds.splice(index, 1);
|
||||||
playlist.videoIds = JSON.stringify(videoIds);
|
playlist.videoIds = JSON.stringify(videoIds);
|
||||||
if (videoIds.length == 0) playlist.thumbnail = "https://pipedproxy.kavin.rocks/?host=i.ytimg.com";
|
if (videoIds.length == 0) playlist.thumbnail = "https://pipedproxy.kavin.rocks/?host=i.ytimg.com";
|
||||||
this.createOrUpdateLocalPlaylist(playlist);
|
this.createOrUpdateLocalPlaylist(playlist);
|
||||||
|
Loading…
Reference in New Issue
Block a user