/products, /products/new, /bottling/new, /bottling/:id. Verbindung von der Honigcharge-Detailseite zur Abfuellung, Nav-Dropdown "Mehr" fuer alle Rollen mit Produkte/Abfuellungen erweitert.
25 lines
835 B
TypeScript
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),
|
|
});
|
|
}
|