From 86c487ae403ed9a04f7cec3f4c075552c16f3aee Mon Sep 17 00:00:00 2001 From: hiderfong Date: Thu, 23 Apr 2026 10:51:06 +0800 Subject: [PATCH] fix: levels and categories empty due to res vs res.data mismatch - Fix Classification.vue: levels use res.data, auto-fetch on mount - Fix Task.vue: levels and categories use res.data - Fix Project.vue: templates use res.data --- frontend/src/views/classification/Classification.vue | 3 ++- frontend/src/views/project/Project.vue | 2 +- frontend/src/views/task/Task.vue | 4 ++-- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/frontend/src/views/classification/Classification.vue b/frontend/src/views/classification/Classification.vue index ba93df57..3839b134 100644 --- a/frontend/src/views/classification/Classification.vue +++ b/frontend/src/views/classification/Classification.vue @@ -124,7 +124,7 @@ async function fetchMeta() { try { const [pRes, lRes] = await Promise.all([getProjects({ page: 1, page_size: 100 }), getDataLevels()]) projects.value = (pRes as any)?.data || [] - levels.value = (lRes as any) || [] + levels.value = (lRes as any)?.data || [] } catch (e) { // ignore } @@ -132,6 +132,7 @@ async function fetchMeta() { onMounted(() => { fetchMeta() + fetchData() }) diff --git a/frontend/src/views/project/Project.vue b/frontend/src/views/project/Project.vue index 83e7bb98..a2e8511d 100644 --- a/frontend/src/views/project/Project.vue +++ b/frontend/src/views/project/Project.vue @@ -215,7 +215,7 @@ async function handleDelete(p: ProjectItem) { async function fetchMeta() { try { const [tRes, sRes] = await Promise.all([getTemplates(), getDataSources()]) - templates.value = (tRes as any) || [] + templates.value = (tRes as any)?.data || [] dataSources.value = (sRes as any)?.data || [] } catch (e) { // ignore diff --git a/frontend/src/views/task/Task.vue b/frontend/src/views/task/Task.vue index 7d7cfc90..12b06b6b 100644 --- a/frontend/src/views/task/Task.vue +++ b/frontend/src/views/task/Task.vue @@ -159,8 +159,8 @@ async function fetchData() { async function fetchMeta() { try { const [catRes, levelRes] = await Promise.all([getCategoryTree(), getDataLevels()]) - levels.value = (levelRes as any) || [] - flatCategories.value = flattenCategories((catRes as any) || []) + levels.value = (levelRes as any)?.data || [] + flatCategories.value = flattenCategories((catRes as any)?.data || []) } catch (e) { // ignore }