2026-05-04-03-50-07 完善项目库可视化和项目管理

This commit is contained in:
2026-05-04 03:59:46 +08:00
parent a9b6d2d76a
commit 26d3109f63
11 changed files with 1010 additions and 88 deletions

View File

@@ -1,4 +1,4 @@
import { OverviewSummary, Project, SessionState, UserRecord } from '../types';
import { DicomPreview, OverviewSummary, Project, SessionState, UserRecord } from '../types';
async function request<T>(path: string, options: RequestInit = {}): Promise<T> {
const response = await fetch(path, {
@@ -36,6 +36,18 @@ export const api = {
getOverview: () => request<OverviewSummary>('/api/overview'),
getProjects: () => request<Project[]>('/api/projects'),
getProject: (projectId: string) => request<Project>(`/api/projects/${projectId}`),
createProject: (name: string) =>
request<Project>('/api/projects', {
method: 'POST',
body: JSON.stringify({ name }),
}),
renameProject: (projectId: string, name: string) =>
request<Project>(`/api/projects/${projectId}`, {
method: 'PATCH',
body: JSON.stringify({ name }),
}),
getDicomPreview: (projectId: string, slice: number) =>
request<DicomPreview>(`/api/projects/${projectId}/dicom-preview?slice=${slice}`),
getUsers: () => request<UserRecord[]>('/api/users'),
resetDemo: () =>
request<{ ok: boolean; projects: Project[]; users: UserRecord[] }>('/api/demo/reset', {