mirror of
https://github.com/ArthurDanjou/artdanj-api.git
synced 2026-01-14 12:14:33 +01:00
Fix error
This commit is contained in:
@@ -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 {
|
||||||
|
|||||||
@@ -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> {
|
||||||
|
|||||||
Reference in New Issue
Block a user