diff --git a/app/Utils/SongUtils.ts b/app/Utils/SongUtils.ts index 7ad2366..2a32d21 100644 --- a/app/Utils/SongUtils.ts +++ b/app/Utils/SongUtils.ts @@ -82,22 +82,19 @@ export async function regenerateTokens(): Promise { } async function RequestWrapper(url: string): Promise | undefined> { - let request const options: AxiosRequestConfig = { headers: { Authorization: `Bearer ${(await getSpotifyAccount()).access_token}`, }, } + try { - request = await axios.get(url, options) + return await axios.get(url, options) } catch (error) { await regenerateTokens() - request = await axios.get(url, options) + return RequestWrapper(url) } - - if (request.status === 200) - return request } export async function getCurrentPlayingFromCache(): Promise {