import { useState, useEffect } from 'react'; import { FontAwesomeIcon } from '@fortawesome/react-fontawesome' import { faMusic } from '@fortawesome/free-solid-svg-icons' export interface NowPlaying { album?: string artist?: string isPlaying: boolean title?: string link?: string album_art?: string } export default function NowPlaying() { const [np, setNp] = useState(); useEffect(() => { fetch( "https://vercel-spotify-api.vercel.app/api/Spotify" ) .then(res => res.json()) .then(data => { if (data) { setNp(data) } }) }) return ( <> {np && np.isPlaying &&
{np.artist}

{np.title}

} ) }