From 191705bf8b0617974c7948503346d8ba810421d2 Mon Sep 17 00:00:00 2001 From: Ryan Freeman Date: Wed, 9 Apr 2025 10:00:26 +0100 Subject: [PATCH] Update spotify.ts --- lib/spotify.ts | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) 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 +}