Spaces:
Sleeping
Sleeping
Download frontend/src/api/projects.ts from DAG-UPB/HeatTransPlan: direct link, hf CLI and curl.
- Browser
- Download file 910 Bytes
-
https://huggingface.co/spaces/DAG-UPB/HeatTransPlan/resolve/main/frontend/src/api/projects.ts
- Command line
-
hf download hf://spaces/DAG-UPB/HeatTransPlan/frontend/src/api/projects.ts
-
curl -L -o projects.ts https://huggingface.co/spaces/DAG-UPB/HeatTransPlan/resolve/main/frontend/src/api/projects.ts
910 Bytes
| import client from './client'; | |
| import type { ProjectState } from '../types/project'; | |
| export async function listProjects(): Promise<Record<string, string>> { | |
| const res = await client.get('/api/projects'); | |
| return res.data; | |
| } | |
| export async function createProject(state?: ProjectState): Promise<{ project_id: string; state: ProjectState }> { | |
| const res = await client.post('/api/projects', state ?? null); | |
| return res.data; | |
| } | |
| export async function getProject(projectId: string): Promise<ProjectState> { | |
| const res = await client.get(`/api/projects/${projectId}`); | |
| return res.data; | |
| } | |
| export async function updateProject(projectId: string, state: ProjectState): Promise<ProjectState> { | |
| const res = await client.put(`/api/projects/${projectId}`, state); | |
| return res.data; | |
| } | |
| export async function deleteProject(projectId: string): Promise<void> { | |
| await client.delete(`/api/projects/${projectId}`); | |
| } | |