Browse Source

default to placeholder if no song in playlist

master
jeffvli 3 years ago
parent
commit
60fd28ed28
  1. 7
      src/api/api.ts

7
src/api/api.ts

@ -86,7 +86,8 @@ export const getPlaylists = async (sortBy: string) => {
return (newData || []).map((playlist: any) => ({ return (newData || []).map((playlist: any) => ({
...playlist, ...playlist,
name: playlist.name, name: playlist.name,
image: playlist.songCount > 0 ? getCoverArtUrl(playlist) : undefined, image:
playlist.songCount > 0 ? getCoverArtUrl(playlist) : 'img/placeholder.jpg',
})); }));
}; };
@ -101,7 +102,9 @@ export const getPlaylist = async (id: string) => {
index, index,
})), })),
image: image:
data.playlist.songCount > 0 ? getCoverArtUrl(data.playlist) : undefined, data.playlist.songCount > 0
? getCoverArtUrl(data.playlist)
: 'img/placeholder.jpg',
}; };
}; };

Loading…
Cancel
Save