|
- "use server";
- //import { BASE_API_URL } from "@/config/api";
- import { BASE_API_URL } from "../../../config/api";
- import { revalidateTag } from "next/cache";
- import { cache } from "react";
- //import { serverFetchJson } from "@/app/utils/fetchUtil";
- import { serverFetchJson } from "../../utils/fetchUtil";
- import { QcItemWithChecks } from ".";
-
- export interface QcResult {
- id: number;
- qcItemId: number;
- name: string;
- code: string;
- stockInLineId?: number;
- stockOutLineId?: number;
- failQty: number;
- }
-
- export const fetchQcItemCheck = cache(async (itemId?: number) => {
- let url = `${BASE_API_URL}/qcCheck`;
- if (itemId) url += `/${itemId}`;
- return serverFetchJson<QcItemWithChecks[]>(url, {
- next: { tags: ["qc"] },
- });
- });
-
- export const fetchQcResult = cache(async (id: number) => {
- return serverFetchJson<QcResult[]>(`${BASE_API_URL}/qcResult/${id}`, {
- next: { tags: ["qc"] },
- });
- });
-
- export const fetchPickOrderQcResult = cache(async (id: number) => {
- return serverFetchJson<QcResult[]>(
- `${BASE_API_URL}/qcResult/pick-order/${id}`,
- {
- next: { tags: ["qc"] },
- },
- );
- });
|