fix: save plModalSongs before closePlModal clears it
closePlModal() resets S.plModalSongs=[] before ids was computed, so no songs were ever added to the playlist. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
1 parent
8e13786e6b
commit
ac5cbfb3de
1 file changed
+3
-2
@@ -190,11 +190,12 @@ export function closePlModal() {
|
||||
S.plModalSongs = [];
|
||||
}
|
||||
export async function addSongsToPlaylist(plId, plName) {
|
||||
const songs = [...S.plModalSongs];
|
||||
closePlModal();
|
||||
try {
|
||||
const ids = S.plModalSongs.map(s => `&songIdToAdd=${s.id}`).join('');
|
||||
const ids = songs.map(s => `&songIdToAdd=${s.id}`).join('');
|
||||
await api('updatePlaylist', `&playlistId=${plId}${ids}`);
|
||||
toast(`✅ ${S.plModalSongs.length===1 ? S.plModalSongs[0].title : S.plModalSongs.length+' Songs'} → ${plName}`);
|
||||
toast(`✅ ${songs.length===1 ? songs[0].title : songs.length+' Songs'} → ${plName}`);
|
||||
} catch(e) { toast('Fehler: ' + e.message); }
|
||||
}
|
||||
export async function createAndAddPlaylist() {
|
||||
|
||||
Reference in new issue
Block a user