FPSMS-frontend
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

42 lines
1.1 KiB

  1. import { cache } from "react";
  2. import "server-only";
  3. // import { serverFetchJson } from "@/app/utils/fetchUtil";
  4. // import { BASE_API_URL } from "@/config/api";
  5. import { serverFetchJson } from "../../utils/fetchUtil";
  6. import { BASE_API_URL } from "../../../config/api";
  7. export interface QcItemWithChecks {
  8. id: number;
  9. code: string;
  10. name: string;
  11. itemId: number;
  12. lowerLimit: number | undefined;
  13. upperLimit: number | undefined;
  14. description: string | undefined;
  15. }
  16. export interface QcData {
  17. id?: number,
  18. qcItemId: number,
  19. code: string,
  20. name: string,
  21. qcDescription: string,
  22. qcPassed: boolean | undefined
  23. failQty: number | undefined
  24. remarks: string | undefined
  25. }
  26. export const fetchQcItemCheckList = cache(async () => {
  27. return serverFetchJson<QcItemWithChecks[]>(`${BASE_API_URL}/qc/list`, {
  28. next: { tags: ["qc"] },
  29. });
  30. });
  31. export const fetchQcItemCheck = cache(async (itemId?: number) => {
  32. let url = `${BASE_API_URL}/qcCheck`;
  33. if (itemId) url += `/${itemId}`;
  34. return serverFetchJson<QcItemWithChecks[]>(url, {
  35. next: { tags: ["qc"] },
  36. });
  37. });