From 7539a4129fb622697d5b095e6513d4b7b22b5a7a Mon Sep 17 00:00:00 2001 From: bietiaop <1527109126@qq.com> Date: Tue, 4 Feb 2025 22:14:23 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E8=8E=B7=E5=8F=96=E6=AD=8C=E5=8D=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- napcat.webui/src/contexts/songs.tsx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/napcat.webui/src/contexts/songs.tsx b/napcat.webui/src/contexts/songs.tsx index 7e6e580a..fce67c5a 100644 --- a/napcat.webui/src/contexts/songs.tsx +++ b/napcat.webui/src/contexts/songs.tsx @@ -35,6 +35,7 @@ const AudioProvider: React.FC = ({ children }) => { const [musicId, setMusicId] = useState(0) const [playMode, setPlayMode] = useState(PlayMode.Loop) const music = musicList.find((music) => music.id === musicId) + const [token] = useLocalStorage(key.token, '') const onNext = () => { const nextID = getNextMusic(musicList, musicId, playMode) setMusicId(nextID) @@ -60,8 +61,8 @@ const AudioProvider: React.FC = ({ children }) => { setMusicId(res[0].id) } useEffect(() => { - fetchMusicList(listId) - }, [listId]) + if (listId && token) fetchMusicList(listId) + }, [listId, token]) return (