From ad3d7bf1a5943887a9db1e2f2ca1fd1286320d7d Mon Sep 17 00:00:00 2001 From: Julien Calixte Date: Sat, 8 Aug 2020 16:30:00 +0200 Subject: [PATCH] :bug: (spotify) try to fix the bug when we want to resume but the token is invalid --- src/hooks/useSpotify.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/hooks/useSpotify.ts b/src/hooks/useSpotify.ts index 5db2060..9bc62d0 100644 --- a/src/hooks/useSpotify.ts +++ b/src/hooks/useSpotify.ts @@ -56,6 +56,9 @@ export const useSpotify = (onPlay: () => void, onPause: () => void) => { }) const play = async () => { + if (!hasValidAccessToken.value) { + redirectToSpotifyConnect() + } try { if (spotify.player && ready.value) { const playerState = await spotify.player.getCurrentState() @@ -68,6 +71,7 @@ export const useSpotify = (onPlay: () => void, onPause: () => void) => { } } catch (error) { console.warn(error) + redirectToSpotifyConnect() } }