mirror of
https://github.com/markuryy/shark.git
synced 2025-12-12 11:41:02 +00:00
fix(spotify): handle possible undefined access and refresh tokens
This commit is contained in:
@@ -185,13 +185,13 @@ export class SpotifyAPI {
|
||||
this.expiresAt = Date.now() + (data.expires_in * 1000);
|
||||
|
||||
// Note: Spotify may or may not return a new refresh token
|
||||
const refreshToken = data.refresh_token || this.refreshToken;
|
||||
const refreshToken = data.refresh_token || this.refreshToken!;
|
||||
if (data.refresh_token) {
|
||||
this.refreshToken = data.refresh_token;
|
||||
}
|
||||
|
||||
// Save refreshed tokens to store
|
||||
await saveTokens(this.accessToken, refreshToken, data.expires_in);
|
||||
await saveTokens(this.accessToken!, refreshToken, data.expires_in);
|
||||
|
||||
return {
|
||||
access_token: data.access_token,
|
||||
|
||||
Reference in New Issue
Block a user