feat: 接入项目编辑与删除接口
This commit is contained in:
1 parent
2128b37058
commit
0af510035f
1 file changed
+5
-1
@@ -1,6 +1,6 @@
|
|||||||
import { request, optionalResource } from '../../lib/http'
|
import { request, optionalResource } from '../../lib/http'
|
||||||
import type { Checkpoint } from '../workflows/types'
|
import type { Checkpoint } from '../workflows/types'
|
||||||
import type { CreateProjectInput, DramaState, Project, ProjectDetail } from './types'
|
import type { CreateProjectInput, DramaState, Project, ProjectDetail, UpdateProjectInput } from './types'
|
||||||
|
|
||||||
/** 项目与 Create Drama API;路径严格对应后端 dev。 */
|
/** 项目与 Create Drama API;路径严格对应后端 dev。 */
|
||||||
export const projectsApi = {
|
export const projectsApi = {
|
||||||
@@ -9,6 +9,10 @@ export const projectsApi = {
|
|||||||
request<ProjectDetail>(`/projects/${encodeURIComponent(id)}`, { signal }),
|
request<ProjectDetail>(`/projects/${encodeURIComponent(id)}`, { signal }),
|
||||||
create: (input: CreateProjectInput) =>
|
create: (input: CreateProjectInput) =>
|
||||||
request<{ projectId: string; status: string }>('/projects', { method: 'POST', body: input }),
|
request<{ projectId: string; status: string }>('/projects', { method: 'POST', body: input }),
|
||||||
|
update: (id: string, input: UpdateProjectInput) =>
|
||||||
|
request<Project>(`/projects/${encodeURIComponent(id)}`, { method: 'PUT', body: input }),
|
||||||
|
delete: (id: string) =>
|
||||||
|
request<{ id: string; deleted: boolean }>(`/projects/${encodeURIComponent(id)}`, { method: 'DELETE' }),
|
||||||
state: (id: string, signal?: AbortSignal) =>
|
state: (id: string, signal?: AbortSignal) =>
|
||||||
optionalResource(request<DramaState>(`/projects/${encodeURIComponent(id)}/state`, { signal })),
|
optionalResource(request<DramaState>(`/projects/${encodeURIComponent(id)}/state`, { signal })),
|
||||||
checkpoints: (id: string, signal?: AbortSignal) =>
|
checkpoints: (id: string, signal?: AbortSignal) =>
|
||||||
|
|||||||
Reference in new issue
Block a user