fix(Player): Fixed fetch lrc file bug.

feature/artists
mackt 4 months ago
parent 2d374263f7
commit 2c5dce0f78

@ -60,11 +60,20 @@ export default function PlayerCard({ show, className }: Prop) {
return;
}
const res: FetchResponse<Promise<string>> = await clientHttp.get(lrcUrl);
if (res.code === 200) {
const lrc = (await res.data) || '';
setLrcData(lrc);
}
fetch(lrcUrl)
.then((response) => {
if (!response.ok) {
throw new Error('Network response was not ok');
}
return response.text(); // 假设文件是文本格式
})
.then((data) => {
const lrc = data || '';
setLrcData(lrc);
})
.catch((error) => {
console.error('There was a problem with the fetch operation:', error);
});
};
// 清空列表

Loading…
Cancel
Save