feat(app): event status transitions on detail header

Add transition buttons from allowed_transitions with Dutch labels,
confirmation dialog, TanStack mutation + cache invalidation, and
422/generic error handling via notification store.

Made-with: Cursor
This commit is contained in:
2026-04-12 22:20:36 +02:00
parent f6e3568011
commit 1172c41d33
4 changed files with 184 additions and 4 deletions

View File

@@ -5,6 +5,7 @@ import type {
CreateEventPayload,
EventItem,
EventStats,
EventStatus,
UpdateEventPayload,
} from '@/types/event'
@@ -132,6 +133,25 @@ export function useUpdateEvent(orgId: Ref<string>, id: Ref<string>) {
})
}
export function useTransitionEventStatus(orgId: Ref<string>, eventId: Ref<string>) {
const queryClient = useQueryClient()
return useMutation({
mutationFn: async (status: EventStatus) => {
const { data } = await apiClient.post<ApiResponse<EventItem>>(
`/organisations/${orgId.value}/events/${eventId.value}/transition`,
{ status },
)
return data.data
},
onSuccess: () => {
queryClient.invalidateQueries({ queryKey: ['events', orgId.value] })
queryClient.invalidateQueries({ queryKey: ['events', orgId.value, eventId.value] })
queryClient.invalidateQueries({ queryKey: ['event-children', eventId.value] })
},
})
}
export function useUploadEventImage(orgId: Ref<string>, eventId: Ref<string>) {
const queryClient = useQueryClient()