🐛 (spotify) try to fix the bug when we want to resume but the token is invalid

This commit is contained in:
Julien Calixte
2020-08-08 16:30:00 +02:00
parent 1faf0ff9a3
commit ad3d7bf1a5

View File

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