From 7e14084163f1f022e7337ee25b48ac9d97cd5f52 Mon Sep 17 00:00:00 2001 From: Jordan Nguy Date: Sat, 25 Sep 2021 17:50:10 -0700 Subject: [PATCH] Binds recursive call function to keep original scope --- src/services/third-party.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/services/third-party.ts b/src/services/third-party.ts index 6eaf644..0924b80 100644 --- a/src/services/third-party.ts +++ b/src/services/third-party.ts @@ -33,6 +33,6 @@ export default class ThirdParty { const auth = await this.spotify.clientCredentialsGrant(); this.spotify.setAccessToken(auth.body.access_token); - this.spotifyTokenTimerId = setTimeout(this.refreshSpotifyToken, (auth.body.expires_in / 2) * 1000); + this.spotifyTokenTimerId = setTimeout(this.refreshSpotifyToken.bind(this), (auth.body.expires_in / 2) * 1000); } }