From 6b23bb4585769dae01dbfb5fe910e91a0f28731d Mon Sep 17 00:00:00 2001 From: cfdaily Date: Sun, 17 May 2026 06:36:16 +0800 Subject: [PATCH] auto-sync: 2026-05-17 06:36:16 --- src/frontend/src/api.ts | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/frontend/src/api.ts b/src/frontend/src/api.ts index c0ecea3..b3e8903 100644 --- a/src/frontend/src/api.ts +++ b/src/frontend/src/api.ts @@ -24,7 +24,14 @@ async function fetchJSON(url: string, options?: RequestInit): Promise { // ---- Projects ---- export async function listProjects(): Promise { - return fetchJSON('/projects'); + const data = await fetchJSON('/projects'); + if (Array.isArray(data)) return data as Project[]; + if (data && typeof data === 'object') { + const obj = data as Record; + const projectsObj = ('projects' in obj ? obj.projects : obj) as Record; + return Object.values(projectsObj); + } + return []; } export async function getProject(projectId: string): Promise {