|
- import { serverFetchJson } from "@/app/utils/fetchUtil";
- import { BASE_API_URL } from "@/config/api";
- import { cache } from "react";
- import "server-only";
-
- export interface InventoryResult {
- id: number;
- itemCode: string;
- itemName: string;
- itemType: string;
- availableQty: number;
- uomCode: string;
- uomUdfudesc: string;
- // germPerSmallestUnit: number;
- // qtyPerSmallestUnit: number;
- // smallestUnit: string;
- price: number;
- currencyName: string;
- status: string;
- }
-
- export const preloadInventory = () => {
- fetchInventories();
- };
-
- export const fetchInventories = cache(async () => {
- return serverFetchJson<InventoryResult[]>(`${BASE_API_URL}/inventory/list`, {
- next: { tags: ["inventories"] },
- });
- });
|