Skip to content

Instantly share code, notes, and snippets.

Created September 12, 2018 18:47
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
What would you like to do?
export async function getUserPlaylists() {
//returns an array of objects with playlist name (like "Favorite Smashing Pumpkins jamz")
//and the id of the playlist. Use this to feed the playlists selection list
try {
const playlistsResponse = await spotifyApi.getUserPlaylists();
//playlistsResponse.items are the actual playlist objects
const playlists = => {
const {id, name} = playlistObject;
return {id: id, playlistName: name}
return playlists
catch(err) {
//return default array with note that can't download playlists
console.error('Error: Attempting to get user playlists', err);
return [{id: null, playlistName: "Can't Download your Playlists!"}]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment