feat: status dropdown on task detail page

This commit is contained in:
Gros Frumos 2026-03-15 18:17:57 +02:00
parent 9cbb3cec37
commit 6e872121eb
4 changed files with 102 additions and 0 deletions

View file

@ -6,6 +6,16 @@ async function get<T>(path: string): Promise<T> {
return res.json()
}
async function patch<T>(path: string, body: unknown): Promise<T> {
const res = await fetch(`${BASE}${path}`, {
method: 'PATCH',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify(body),
})
if (!res.ok) throw new Error(`${res.status} ${res.statusText}`)
return res.json()
}
async function post<T>(path: string, body: unknown): Promise<T> {
const res = await fetch(`${BASE}${path}`, {
method: 'POST',
@ -148,4 +158,6 @@ export const api = {
post<AuditResult>(`/projects/${projectId}/audit`, {}),
auditApply: (projectId: string, taskIds: string[]) =>
post<{ updated: string[]; count: number }>(`/projects/${projectId}/audit/apply`, { task_ids: taskIds }),
patchTask: (id: string, data: { status: string }) =>
patch<Task>(`/tasks/${id}`, data),
}