FPSMS-frontend
Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.
 
 
 

36 rindas
920 B

  1. // import { serverFetchJson } from "@/app/utils/fetchUtil";
  2. // import { BASE_API_URL } from "@/config/api";
  3. import { serverFetchJson } from "../../../utils/fetchUtil";
  4. import { BASE_API_URL } from "../../../../config/api";
  5. import { cache } from "react";
  6. import "server-only";
  7. import { SaveQcItemInputs } from "./actions";
  8. import next from "next";
  9. export interface QcItemResult {
  10. id: number;
  11. code: string;
  12. name: string;
  13. description: string;
  14. }
  15. export const preloadQcItem = () => {
  16. fetchQcItems();
  17. };
  18. export const fetchQcItems = cache(async () => {
  19. return serverFetchJson<QcItemResult[]>(`${BASE_API_URL}/qcItems`, {
  20. next: { tags: ["qcItems"] },
  21. });
  22. });
  23. export const fetchQcItemDetails = cache(async (qcItemId: string) => {
  24. return serverFetchJson<SaveQcItemInputs>(
  25. `${BASE_API_URL}/qcItems/qcItemDetails/${qcItemId}`,
  26. {
  27. next: { tags: [`qcItemDetails_${qcItemId}`] },
  28. },
  29. );
  30. });