|
- import { cache } from "react";
- import "server-only";
- import { serverFetchJson } from "@/app/utils/fetchUtil";
- import { BASE_API_URL } from "@/config/api";
-
- export interface WarehouseResult {
- action: any;
- id: number;
- code: string;
- name: string;
- description: string;
- store_id?: string;
- warehouse?: string;
- area?: string;
- slot?: string;
- order?: string;
- stockTakeSection?: string;
- }
-
- export interface WarehouseCombo {
- id: number;
- value: number;
- label: string;
- }
-
- export const fetchWarehouseList = cache(async () => {
- return serverFetchJson<WarehouseResult[]>(`${BASE_API_URL}/warehouse`, {
- next: { tags: ["warehouse"] },
- });
- });
-
- export const fetchWarehouseCombo = cache(async () => {
- return serverFetchJson<WarehouseCombo[]>(`${BASE_API_URL}/warehouse/combo`, {
- next: { tags: ["warehouseCombo"] },
- });
- });
|