Files
cymelle/orders-frontend/src/api/inventory.ts
T
2026-06-14 13:19:39 +03:00

25 lines
613 B
TypeScript

import { apiRequest } from "#/api/client";
import type {
InventoryResponse,
LowStockInventoryResponse,
} from "#/types/inventory";
export function getInventory(signal?: AbortSignal) {
return apiRequest<InventoryResponse>("/inventory", { signal });
}
export function getLowStockInventory(threshold?: number, signal?: AbortSignal) {
const params = new URLSearchParams();
if (threshold !== undefined) {
params.set("threshold", String(threshold));
}
const query = params.toString();
return apiRequest<LowStockInventoryResponse>(
`/inventory/low-stock${query ? `?${query}` : ""}`,
{ signal },
);
}