Skip to content

Commit

Permalink
[fix] update cors headers
Browse files Browse the repository at this point in the history
  • Loading branch information
AmosChenZixuan committed May 5, 2024
1 parent 4455a67 commit ac661d5
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion components/home/SpotifyPlayerBox.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ export default function SpotifyPlayerBox() {
const fetcher = (url) => fetch(url).then((r) => r.json())
const { data }: { data: SongData } = useSWR('/api/spotify', fetcher)

const imageLoader = ({ src }) => {
return `/api/imageProxy?url=${encodeURIComponent(src)}`
}

return (
<div
className={`card bg-pink-blue-animated animation-delay-1 flex-center flex-grow overflow-hidden p-2`}
Expand All @@ -31,7 +35,8 @@ export default function SpotifyPlayerBox() {
</section>
<section className="relative mx-auto h-24 w-24">
<Image
src={`/api/imageProxy?url=${encodeURIComponent(data.albumImageUrl)}`}
loader={imageLoader}
src={data.albumImageUrl}
alt={data.album}
width={375}
height={375}
Expand Down

0 comments on commit ac661d5

Please sign in to comment.