🐛 (spotify)
This commit is contained in:
@@ -8,7 +8,6 @@
|
||||
content="width=device-width,initial-scale=1.0,user-scalable=no"
|
||||
/>
|
||||
<link rel="icon" href="<%= BASE_URL %>favicon.ico" />
|
||||
<script src="https://sdk.scdn.co/spotify-player.js"></script>
|
||||
<title>Binôme</title>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
@@ -9,9 +9,7 @@ import {
|
||||
playOnSpotify,
|
||||
pauseOnSpotify
|
||||
} from '@/utils/spotify'
|
||||
import { ref, reactive } from '@vue/composition-api'
|
||||
|
||||
window.onSpotifyWebPlaybackSDKReady = () => {}
|
||||
import { ref, reactive, onMounted } from '@vue/composition-api'
|
||||
|
||||
export const useSpotify = (onPlay: () => void, onPause: () => void) => {
|
||||
const ready = ref(false)
|
||||
@@ -26,6 +24,7 @@ export const useSpotify = (onPlay: () => void, onPause: () => void) => {
|
||||
RootActions
|
||||
>(['setAccessToken', 'setTokenExpire', 'setHasSpotify'])
|
||||
|
||||
onMounted(() => {
|
||||
window.onSpotifyWebPlaybackSDKReady = async () => {
|
||||
if (!hasValidAccessToken.value) {
|
||||
redirectToSpotifyConnect()
|
||||
@@ -63,6 +62,8 @@ export const useSpotify = (onPlay: () => void, onPause: () => void) => {
|
||||
})
|
||||
await spotify.player.connect()
|
||||
}
|
||||
import('@/lib/spotify-player')
|
||||
})
|
||||
|
||||
const play = async () => {
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user