Skip to content

Commit

Permalink
fix podcast
Browse files Browse the repository at this point in the history
  • Loading branch information
ryan-parag committed Oct 18, 2021
1 parent 7c13678 commit 10bd9a2
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions pages/api/podcast-playing.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@ import { getPodcastPlaying } from '@utils/spotify';
export default async (_, res) => {
const response = await getPodcastPlaying();

const podcast = await response.json();

if (response.status === 204 || response.status > 400 || response.status === 500) {
return res.status(200).json({ isPlaying: false, playing: null });
}

const podcast = await response.json();

if(podcast.context.type !== 'show') {
if(podcast.currently_playing_type !== 'episode') {
return res.status(200).json({ isPlaying: false, playing: 'track' });
}

Expand All @@ -29,10 +29,10 @@ export default async (_, res) => {

return res.status(200).json({
isPlaying,
publisher,
podcastName,
episodeTitle,
episodeDescription,
podcastName,
publisher,
podcastImgUrl,
podcastUrl,
explicit
Expand Down

1 comment on commit 10bd9a2

@vercel
Copy link

@vercel vercel bot commented on 10bd9a2 Oct 18, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.