diff --git a/apps/web/src/api/projects.ts b/apps/web/src/api/projects.ts index 4367ae395..fb3d73bb1 100644 --- a/apps/web/src/api/projects.ts +++ b/apps/web/src/api/projects.ts @@ -6,32 +6,32 @@ import apiClient from './client'; export interface ProjectItem { id: string; - owner_user_id: string; name: string; description: string; - shared_users: string[]; } +/** 后端 ProjectResponse 只返回 id, name, description */ interface BackendProjectResponse { id: string; - owner_user_id: string; name: string; description: string; - shared_users: string[]; +} + +/** 后端 ListProjectsResponse 返回 { items: [...] } */ +interface BackendListProjectsResponse { + items: BackendProjectResponse[]; } const toProjectItem = (item: BackendProjectResponse): ProjectItem => ({ id: item.id, - owner_user_id: item.owner_user_id, name: item.name, description: item.description, - shared_users: item.shared_users || [], }); /** 获取当前用户的项目列表 */ export const getProjects = async (): Promise => { - const response = await apiClient.get('/projects'); - return (response.data || []).map(toProjectItem); + const response = await apiClient.get('/projects'); + return (response.data.items || []).map(toProjectItem); }; /** 创建项目 */