diff --git a/app/Types/ISpotify.ts b/app/Types/ISpotify.ts index c4f6810..b7a1975 100644 --- a/app/Types/ISpotify.ts +++ b/app/Types/ISpotify.ts @@ -1,7 +1,6 @@ export interface SpotifyToken { access_token: string refresh_token: string - expires_in: number } interface Device { diff --git a/app/Utils/SongUtils.ts b/app/Utils/SongUtils.ts index 2e13e75..e6b90a9 100644 --- a/app/Utils/SongUtils.ts +++ b/app/Utils/SongUtils.ts @@ -13,7 +13,6 @@ export async function getSpotifyAccount(): Promise { : { access_token: '', refresh_token: '', - expires_in: -1, } } @@ -74,8 +73,12 @@ export async function regenerateTokens(): Promise { }, ) - if (authorization_tokens.status === 200) - await setSpotifyAccount(authorization_tokens.data) + if (authorization_tokens.status === 200) { + await setSpotifyAccount({ + access_token: (await getSpotifyAccount()).access_token, + refresh_token: authorization_tokens.data.access_token, + }) + } } async function RequestWrapper(url: string): Promise | undefined> {