FPSMS-frontend
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
 
 

33 行
767 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. export interface QcCategoryResult {
  6. id: number;
  7. code: string;
  8. name: string;
  9. }
  10. export interface QcCategoryCombo {
  11. id: number;
  12. value: number;
  13. label: string;
  14. }
  15. export const preloadQcCategory = () => {
  16. fetchQcCategories();
  17. };
  18. export const fetchQcCategories = cache(async () => {
  19. return serverFetchJson<QcCategoryResult[]>(`${BASE_API_URL}/qcCategories`, {
  20. next: { tags: ["qcCategories"] },
  21. });
  22. });
  23. export const fetchQcCategoryCombo = cache(async () => {
  24. return serverFetchJson<QcCategoryCombo[]>(`${BASE_API_URL}/qcCategories/combo`, {
  25. next: { tags: ["qcCategoryCombo"] },
  26. });
  27. });