Skip to content

Commit

Permalink
fix: hook get playlist only brings 5 playlists
Browse files Browse the repository at this point in the history
  • Loading branch information
AntonioMrtz committed Oct 12, 2024
1 parent 515dfd3 commit 6f21d6f
Showing 1 changed file with 16 additions and 18 deletions.
34 changes: 16 additions & 18 deletions Electron/src/hooks/useFetchGetPlaylists.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,24 +18,22 @@ const useFetchGetPlaylists = (refreshSidebarData: () => void) => {
if (data.playlists) {
const propsPlaylists: PropsPlaylistCard[] = [];

data.playlists
.slice(0, 5) // TODO get only a portion of total playlists in the query
.forEach((playlist: any) => {
const propsPlaylist: PropsPlaylistCard = {
name: playlist.name,
photo:
playlist.photo === ''
? defaultThumbnailPlaylist
: playlist.photo,
description: playlist.description,
refreshSidebarData,
owner: playlist.owner,
};

propsPlaylists.push(propsPlaylist);

setPlaylists(propsPlaylists);
});
data.playlists.forEach((playlist: any) => {
const propsPlaylist: PropsPlaylistCard = {
name: playlist.name,
photo:
playlist.photo === ''
? defaultThumbnailPlaylist
: playlist.photo,
description: playlist.description,
refreshSidebarData,
owner: playlist.owner,
};

propsPlaylists.push(propsPlaylist);

setPlaylists(propsPlaylists);
});
}
} catch (err) {
console.log(err);
Expand Down

0 comments on commit 6f21d6f

Please sign in to comment.