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() } }