diff --git a/lib/spotify.ts b/lib/spotify.ts index 4bc8783..b5dd0ae 100644 --- a/lib/spotify.ts +++ b/lib/spotify.ts @@ -45,11 +45,16 @@ export const getCurrentlyPlaying = async () => { export const getRecentlyPlayed = async () => { - const {access_token}: Response = await getAccessToken() as Response - + try { + const {access_token}: Response = await getAccessToken() as Response + } catch(e) { + console.error(e) + return null + } + return await fetch(SPOTIFY_RECENTLY_PLAYED, { headers: { Authorization: `Bearer ${access_token}` } }) -} \ No newline at end of file +}