Files
ApiCore/ApiCore-Frontend/src/lib/bottling/api.ts
T
Nick Szaunig f4df719df7 feat(frontend): Abfuellungen und Produkte (Modul 23)
/products, /products/new, /bottling/new, /bottling/:id. Verbindung
von der Honigcharge-Detailseite zur Abfuellung, Nav-Dropdown "Mehr"
fuer alle Rollen mit Produkte/Abfuellungen erweitert.
2026-08-22 22:21:22 +02:00

25 lines
835 B
TypeScript

import { apiFetch } from "@/lib/auth/api-client";
import { BottlingBatch, BottlingBatchFilter, CreateBottlingBatchInput } from "./types";
export function fetchBottlingBatches(
filter: BottlingBatchFilter = {},
): Promise<BottlingBatch[]> {
const params = new URLSearchParams();
if (filter.honeyBatchId) params.set("honeyBatchId", filter.honeyBatchId);
const query = params.toString();
return apiFetch<BottlingBatch[]>(`/bottling-batches${query ? `?${query}` : ""}`);
}
export function fetchBottlingBatch(id: string): Promise<BottlingBatch> {
return apiFetch<BottlingBatch>(`/bottling-batches/${id}`);
}
export function createBottlingBatch(
input: CreateBottlingBatchInput,
): Promise<BottlingBatch> {
return apiFetch<BottlingBatch>("/bottling-batches", {
method: "POST",
body: JSON.stringify(input),
});
}