Update spotify.ts

Signed-off-by: skidoodle <53189968+skidoodle@users.noreply.github.com>
This commit is contained in:
skidoodle 2022-10-25 14:24:51 +02:00 committed by GitHub
parent 505416d710
commit 6589de9aa7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -6,7 +6,7 @@ export default async function (req: NextApiRequest, res: NextApiResponse) {
const spotify = new SpotifyService(CLIENT_ID!, CLIENT_SECRET!, REFRESH_TOKEN!)
const song = await spotify.getCurrentSong()
if(!song || !song.isPlaying ) {
if(!song.error || !song.isPlaying ) {
return res.status(200).json({
nowplaying: false,
});
@ -20,4 +20,4 @@ export default async function (req: NextApiRequest, res: NextApiResponse) {
url: song.externalUrl,
}
});
}
}