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
This commit is contained in:
@@ -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()
|
||||
})
|
||||
</script>
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user