mirror of
https://github.com/andwati/cymelle.git
synced 2026-10-24 02:42:15 +00:00
25 lines
613 B
TypeScript
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 },
|
|
);
|
|
}
|