fix api when song is not playing

This commit is contained in:
skidoodle 2022-10-21 17:55:12 +02:00
parent 75ac9e792a
commit 2174a08186

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 spotify = new SpotifyService(CLIENT_ID!, CLIENT_SECRET!, REFRESH_TOKEN!)
const song = await spotify.getCurrentSong() const song = await spotify.getCurrentSong()
if(!song.isPlaying) { if(!song || !song.isPlaying ) {
return res.status(200).json({ return res.status(200).json({
nowplaying: false, nowplaying: false,
}); });