mirror of
https://github.com/NapNeko/NapCatQQ.git
synced 2025-07-19 12:03:37 +00:00
fix: 获取歌单
This commit is contained in:
@@ -35,6 +35,7 @@ const AudioProvider: React.FC<MusicProviderProps> = ({ children }) => {
|
|||||||
const [musicId, setMusicId] = useState<number>(0)
|
const [musicId, setMusicId] = useState<number>(0)
|
||||||
const [playMode, setPlayMode] = useState<PlayMode>(PlayMode.Loop)
|
const [playMode, setPlayMode] = useState<PlayMode>(PlayMode.Loop)
|
||||||
const music = musicList.find((music) => music.id === musicId)
|
const music = musicList.find((music) => music.id === musicId)
|
||||||
|
const [token] = useLocalStorage(key.token, '')
|
||||||
const onNext = () => {
|
const onNext = () => {
|
||||||
const nextID = getNextMusic(musicList, musicId, playMode)
|
const nextID = getNextMusic(musicList, musicId, playMode)
|
||||||
setMusicId(nextID)
|
setMusicId(nextID)
|
||||||
@@ -60,8 +61,8 @@ const AudioProvider: React.FC<MusicProviderProps> = ({ children }) => {
|
|||||||
setMusicId(res[0].id)
|
setMusicId(res[0].id)
|
||||||
}
|
}
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
fetchMusicList(listId)
|
if (listId && token) fetchMusicList(listId)
|
||||||
}, [listId])
|
}, [listId, token])
|
||||||
return (
|
return (
|
||||||
<AudioContext.Provider
|
<AudioContext.Provider
|
||||||
value={{
|
value={{
|
||||||
|
Reference in New Issue
Block a user