2026-07-05 06:41:23 +02:00
|
|
|
import { apiFetch } from './client.js'
|
|
|
|
|
|
|
|
|
|
export function getAction(id) {
|
|
|
|
|
return apiFetch(`/api/actions/${id}`)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export function updateAction(id, payload) {
|
|
|
|
|
return apiFetch(`/api/actions/${id}`, {
|
|
|
|
|
method: 'PATCH',
|
|
|
|
|
body: JSON.stringify(payload),
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export function setActionAssignments(id, actorIds) {
|
|
|
|
|
return apiFetch(`/api/actions/${id}/assignments`, {
|
|
|
|
|
method: 'PUT',
|
|
|
|
|
body: JSON.stringify({ actor_ids: actorIds }),
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export function deleteAction(id) {
|
|
|
|
|
return apiFetch(`/api/actions/${id}`, { method: 'DELETE' })
|
|
|
|
|
}
|
|
|
|
|
|
2026-07-13 08:07:02 +02:00
|
|
|
export function unplanActionToBacklog(id) {
|
|
|
|
|
return apiFetch(`/api/actions/${id}/unplan-to-backlog`, { method: 'POST' })
|
|
|
|
|
}
|
|
|
|
|
|
2026-07-05 06:41:23 +02:00
|
|
|
export function listMyOpenActions() {
|
|
|
|
|
return apiFetch('/api/actions/me/open')
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/** Offene Maßnahmen = open, in_progress, blocked (Backend-Filter). */
|
|
|
|
|
export function countOpenActions(actions) {
|
|
|
|
|
return actions.filter((a) => ['open', 'in_progress', 'blocked'].includes(a.status)).length
|
|
|
|
|
}
|