FPSMS-frontend
Non puoi selezionare più di 25 argomenti Gli argomenti devono iniziare con una lettera o un numero, possono includere trattini ('-') e possono essere lunghi fino a 35 caratteri.
 
 
 

32 righe
829 B

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