Skip to content

Commit

Permalink
fix: album url image
Browse files Browse the repository at this point in the history
  • Loading branch information
Raul Andrade committed Feb 28, 2022
1 parent c2aeeca commit 8a61428
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 15 deletions.
5 changes: 4 additions & 1 deletion src/pages/api/recommendations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ export default async function handler(
max: topTrack.body.tracks.length
})

console.log(topTrack.body.tracks[topTrackSelected].album.images)

topTrackCollection.push(topTrack.body.tracks[topTrackSelected])
}

Expand All @@ -45,7 +47,8 @@ export default async function handler(
id: topTrackCollection[index].id,
uri: topTrackCollection[index].uri,
name: topTrackCollection[index].name,
previewUrl: topTrackCollection[index].preview_url
previewUrl: topTrackCollection[index].preview_url,
images: topTrackCollection[index].album.images
}
}))

Expand Down
4 changes: 1 addition & 3 deletions src/templates/home/authenticated.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,6 @@ export const Authenticated = ({ artistId }: AuthenticatedProps) => {
)
const mutation = usePlaylistMutation()

console.log(mutation.data)

const handleLike = (artist: Recommendation) => {
setLiked({
id: artist.id,
Expand All @@ -61,7 +59,7 @@ export const Authenticated = ({ artistId }: AuthenticatedProps) => {
{data?.data.map((artist) => (
<ImageBox
key={artist.id}
imgSrc={artist.images[1].url}
imgSrc={artist.track.images[1].url}
audioSrc={artist.track.previewUrl}
track={artist.track.name}
artist={artist.name}
Expand Down
27 changes: 16 additions & 11 deletions src/types/recommendation.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,21 @@
type Images = Array<{
height: number
url: string
width: number
}>

type Track = {
id: string
uri: string
name: string
previewUrl: string
images: Images
}

export type Recommendation = {
id: string
images: Array<{
height: number
url: string
width: number
}>
images: Images
type: string
name: string
track: {
id: string
uri: string
name: string
previewUrl: string
}
track: Track
}

1 comment on commit 8a61428

@vercel
Copy link

@vercel vercel bot commented on 8a61428 Feb 28, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.