Created
March 15, 2022 08:26
-
-
Save Hkazanci93/1a247d704696b015513f1381dbb3a969 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const songs = JSON.parse(await jsonGetAsync(getUserKey(username), `.playlist.${playlistId}.queue`)) | |
const songIndex = songs.findIndex(song => song.id === songId) | |
const success = songIndex !== -1 | |
if (success) { | |
songs.splice(songIndex, 1) | |
} | |
try { | |
await jsonSetAsync(getUserKey(username), `.playlist.${playlistId}.queue`, JSON.stringify(songs)) | |
} catch (error) { | |
return res.status(400).json(error) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment