|
- // 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";
-
- import { cache } from "react";
- import "server-only";
- import { SaveQcItemInputs } from "./actions";
- import next from "next";
-
- export interface QcItemResult {
- id: number;
- code: string;
- name: string;
- description: string;
- }
-
- export const preloadQcItem = () => {
- fetchQcItems();
- };
-
- export const fetchQcItems = cache(async () => {
- return serverFetchJson<QcItemResult[]>(`${BASE_API_URL}/qcItems`, {
- next: { tags: ["qcItems"] },
- });
- });
-
- export const fetchQcItemDetails = cache(async (qcItemId: string) => {
- return serverFetchJson<SaveQcItemInputs>(
- `${BASE_API_URL}/qcItems/qcItemDetails/${qcItemId}`,
- {
- next: { tags: [`qcItemDetails_${qcItemId}`] },
- },
- );
- });
|