nem is spotify hanem lastfm

This commit is contained in:
arch0Xd 2022-08-14 18:37:24 +02:00
parent af344d5fcd
commit 2b6124cbf9
2 changed files with 18 additions and 8 deletions

View file

@ -13,7 +13,7 @@ export default async function(req: NextApiRequest, res: NextApiResponse) {
let nowplaying = Boolean(track[0]['@attr']?.nowplaying)
if(nowplaying) {
res.status(200).json({
return res.status(200).json({
nowplaying,
song: {
artist: artist['#text'],
@ -24,5 +24,5 @@ export default async function(req: NextApiRequest, res: NextApiResponse) {
})
}
res.status(200).json({ nowplaying })
return res.status(200).json({ nowplaying })
}

View file

@ -1,14 +1,16 @@
import Image from 'next/image'
import Link from 'next/link'
import React from 'react'
import { socials } from 'components/data/socials'
import { Icon } from 'components/Icon'
import { Toaster } from 'react-hot-toast'
import { GetServerSideProps } from 'next'
import { FaSpotify } from 'react-icons/fa'
import { Footer } from 'components/Footer'
import { Toaster } from 'react-hot-toast'
import { FaSpotify } from 'react-icons/fa'
import { GetServerSideProps } from 'next'
export default function({ spotify }: any) {
return(
<>
@ -28,8 +30,16 @@ export default function({ spotify }: any) {
<div className='mt-3 flex justify-center items-center'>
<FaSpotify className='text-[#32a866]' />&nbsp;
<p className='font-semibold'>Listening to
<span className='text-[#32a866]'> { spotify.song?.artist - spotify.song?.title || 'nothing' }</span>
<p className='font-semibold'>Listening to
{
spotify.song
? <Link href={`${spotify.song.url}`}>
<a className='text-[#32a866]'> { spotify.song.artist + ' - ' + spotify.song.title }</a>
</Link>
: <a className='text-[#32a866]'> nothing</a>
}
</p>
</div>