Files
xiaoxia-saas/apps/web/src/api/projects.ts
T
Xiaoxia AI a1cf1ddd9d
CI/CD Pipeline / Validate Code Quality And Tests (push) Has been cancelled
Deploy / Deploy Staging (push) Has been cancelled
Deploy / Deploy Production (push) Has been cancelled
fix(web): restore project workspace context
2026-06-22 13:19:45 +08:00

30 lines
818 B
TypeScript

import apiClient from './client';
export interface ProjectItem {
id: string;
workspace_id: string;
name: string;
description: string;
}
export interface CreateProjectRequest {
workspace_id: string;
name: string;
description?: string;
}
export const getProject = async (projectId: string): Promise<ProjectItem> => {
const response = await apiClient.get(`/projects/${projectId}`);
return response.data;
};
export const getProjects = async (workspaceId: string): Promise<ProjectItem[]> => {
const response = await apiClient.get('/projects', { params: { workspace_id: workspaceId } });
return response.data.items;
};
export const createProject = async (data: CreateProjectRequest): Promise<ProjectItem> => {
const response = await apiClient.post('/projects', data);
return response.data;
};