Fix error

This commit is contained in:
2022-01-17 23:30:14 +01:00
parent 9adc979c60
commit d36724e3fc
2 changed files with 6 additions and 4 deletions

View File

@@ -1,7 +1,6 @@
export interface SpotifyToken { export interface SpotifyToken {
access_token: string access_token: string
refresh_token: string refresh_token: string
expires_in: number
} }
interface Device { interface Device {

View File

@@ -13,7 +13,6 @@ export async function getSpotifyAccount(): Promise<SpotifyToken> {
: { : {
access_token: '', access_token: '',
refresh_token: '', refresh_token: '',
expires_in: -1,
} }
} }
@@ -74,8 +73,12 @@ export async function regenerateTokens(): Promise<void> {
}, },
) )
if (authorization_tokens.status === 200) if (authorization_tokens.status === 200) {
await setSpotifyAccount(authorization_tokens.data) await setSpotifyAccount({
access_token: (await getSpotifyAccount()).access_token,
refresh_token: authorization_tokens.data.access_token,
})
}
} }
async function RequestWrapper<T = never>(url: string): Promise<AxiosResponse<T> | undefined> { async function RequestWrapper<T = never>(url: string): Promise<AxiosResponse<T> | undefined> {