|
- import { cache } from "react";
- import "server-only";
- // import { serverFetchJson } from "@/app/utils/fetchUtil";
- // import { BASE_API_URL } from "@/config/api";
- import { serverFetchJson } from "../../utils/fetchUtil";
- import { BASE_API_URL } from "../../../config/api";
-
- export interface QcItemWithChecks {
- id: number;
- code: string;
- name: string;
- itemId: number;
- lowerLimit: number | undefined;
- upperLimit: number | undefined;
- description: string | undefined;
- }
-
- export interface QcData {
- id: number,
- code: string,
- name: string,
- qcDescription: string,
- qcPassed: boolean | undefined
- failQty: number | undefined
- remarks: string | undefined
- }
-
- export const fetchQcItemCheckList = cache(async () => {
- return serverFetchJson<QcItemWithChecks[]>(`${BASE_API_URL}/qc/list`, {
- next: { tags: ["qc"] },
- });
- });
-
- export const fetchQcItemCheck = cache(async (itemId?: number) => {
- let url = `${BASE_API_URL}/qcCheck`;
- if (itemId) url += `/${itemId}`;
- return serverFetchJson<QcItemWithChecks[]>(url, {
- next: { tags: ["qc"] },
- });
- });
|