Skip to content

Commit

Permalink
astro-spotify-public - Show Album Images
Browse files Browse the repository at this point in the history
  • Loading branch information
hxrsmurf committed Nov 19, 2023
1 parent 4fbd2a4 commit ef8c964
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions astro-spotify-public/src/components/Albums.astro
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,28 @@ interface Props {
}
const { stat } = Astro.props
const api_url = import.meta.env.API_URL
for (let key in stat) {
let album_id = (stat[key]['albumID'])
const response = await fetch(api_url + '?album_id=' + album_id)
const album = await response.json()
stat[key].album_image=album.album_image
}
---

<h1>Top Albums</h1>
<table>
<th>album_image</th>
<th>albums</th>
<th>count</th>

{stat.map((s: any)=>(
<tr>
<td>
{s.album_image ? <img src={s.album_image} width="320" height="320" alt=""/> : <></>}
</td>
<td>
{s.album}
</td>
Expand Down

0 comments on commit ef8c964

Please sign in to comment.