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.
 
 
 

41 regels
1.0 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. code: string,
  19. name: string,
  20. qcDescription: string,
  21. qcPassed: boolean | undefined
  22. failQty: number | undefined
  23. remarks: string | undefined
  24. }
  25. export const fetchQcItemCheckList = cache(async () => {
  26. return serverFetchJson<QcItemWithChecks[]>(`${BASE_API_URL}/qc/list`, {
  27. next: { tags: ["qc"] },
  28. });
  29. });
  30. export const fetchQcItemCheck = cache(async (itemId?: number) => {
  31. let url = `${BASE_API_URL}/qcCheck`;
  32. if (itemId) url += `/${itemId}`;
  33. return serverFetchJson<QcItemWithChecks[]>(url, {
  34. next: { tags: ["qc"] },
  35. });
  36. });