Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

62 строки
1.2 KiB

  1. import { cache } from "react";
  2. import "server-only";
  3. export interface ProjectResult {
  4. id: number;
  5. code: string;
  6. name: string;
  7. category: "Confirmed Project" | "Project to be bidded";
  8. team: string;
  9. client: string;
  10. }
  11. export interface ProjectCategory {
  12. id: number;
  13. label: string;
  14. }
  15. export const preloadProjects = () => {
  16. fetchProjectCategories();
  17. fetchProjects();
  18. };
  19. export const fetchProjects = cache(async () => {
  20. return mockProjects;
  21. });
  22. export const fetchProjectCategories = cache(async () => {
  23. return mockProjectCategories;
  24. });
  25. const mockProjectCategories: ProjectCategory[] = [
  26. { id: 1, label: "Confirmed Project" },
  27. { id: 2, label: "Project to be bidded" },
  28. ];
  29. const mockProjects: ProjectResult[] = [
  30. {
  31. id: 1,
  32. code: "M1001",
  33. name: "Consultancy Project A",
  34. category: "Confirmed Project",
  35. team: "TW",
  36. client: "Client A",
  37. },
  38. {
  39. id: 2,
  40. code: "M1002",
  41. name: "Consultancy Project B",
  42. category: "Project to be bidded",
  43. team: "WY",
  44. client: "Client B",
  45. },
  46. {
  47. id: 3,
  48. code: "S1001",
  49. name: "Consultancy Project C",
  50. category: "Confirmed Project",
  51. team: "WY",
  52. client: "Client C",
  53. },
  54. ];