import { serverFetchJson } from "@/app/utils/fetchUtil"; import { BASE_API_URL } from "@/config/api"; import { cache } from "react"; import "server-only"; export interface QcCategoryResult { id: number; code: string; name: string; } export interface QcCategoryCombo { id: number; value: number; label: string; } export const preloadQcCategory = () => { fetchQcCategories(); }; export const fetchQcCategories = cache(async () => { return serverFetchJson(`${BASE_API_URL}/qcCategories`, { next: { tags: ["qcCategories"] }, }); }); export const fetchQcCategoryCombo = cache(async () => { return serverFetchJson(`${BASE_API_URL}/qcCategories/combo`, { next: { tags: ["qcCategoryCombo"] }, }); });