This commit is contained in:
Shiny Nematoda 2022-09-23 18:09:40 +00:00
parent 8efa6a6439
commit 945630bc60
No known key found for this signature in database
GPG key ID: 6506D50F5613A42D
3 changed files with 19 additions and 7 deletions

View file

@ -48,6 +48,13 @@ const shuffleAdd = () => {
emit('play-urls', copy); emit('play-urls', copy);
}, },
removeSong = i => {
console.log(i);
try {
results.items.songs.items.splice(i, 1);
} catch {}
},
saveAlbum = () => { saveAlbum = () => {
const urls = results.items?.songs?.items?.map(item => ({ const urls = results.items?.songs?.items?.map(item => ({
url: item.url, url: item.url,
@ -192,6 +199,7 @@ onUpdated(() => {
:art=" :art="
song.thumbnail || song.thumbnails[1]?.url || song.thumbnails[0]?.url song.thumbnail || song.thumbnails[1]?.url || song.thumbnails[0]?.url
" "
@remove="removeSong"
@open-song=" @open-song="
$emit('play-urls', [ $emit('play-urls', [
{ {

View file

@ -48,20 +48,24 @@ const openSong = el => {
emit('open-song', props.play); emit('open-song', props.play);
}, },
Remove = () => { Remove = () => {
// WIP
const auth = useStore().getItem('auth'); const auth = useStore().getItem('auth');
if (auth) { if (auth && confirm('Are you sure?')) {
getJsonAuth('/user/playlists/remove', { getJsonAuth('/user/playlists/remove', {
method: 'POST', method: 'POST',
headers: { headers: {
Authorization: auth, Authorization: auth,
}, },
body: { body: JSON.stringify({
index, index: props.index,
playlistId, playlistId,
}, }),
}).then(json => {
console.log(json);
if (!json.error) {
if (json.message == 'ok') emit('remove', props.index);
} else alert(json.error);
}); });
} }
}, },

View file

@ -47,7 +47,7 @@ function List() {
function Save() { function Save() {
if (pl.value) { if (pl.value) {
if (plRemote.value == true && store.auth) { if (plRemote.value == true && store.auth) {
setAuthAddToPlaylist(data.state.url); useAuthAddToPlaylist(pl.value, data.state.url);
} else if (plRemote.value == false) { } else if (plRemote.value == false) {
useUpdatePlaylist( useUpdatePlaylist(
pl.value, pl.value,