feat: 更新标签列表获取逻辑,支持空数据处理

This commit is contained in:
2025-07-25 04:23:45 +08:00
parent d03730a7fa
commit 1cbfe60f8c
2 changed files with 3 additions and 3 deletions

View File

@ -68,7 +68,7 @@ export default function BlogHome() {
// 获取标签
useEffect(() => {
listLabels().then(data => {
setLabels(data.data);
setLabels(data.data || []);
console.log("Labels:", data.data);
}).catch(error => {
console.error("Failed to fetch labels:", error);