Skip to content

Instantly share code, notes, and snippets.

@Hkazanci93
Created March 15, 2022 08:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Hkazanci93/1a247d704696b015513f1381dbb3a969 to your computer and use it in GitHub Desktop.
Save Hkazanci93/1a247d704696b015513f1381dbb3a969 to your computer and use it in GitHub Desktop.
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