25'ten fazla konu seçemezsiniz Konular bir harf veya rakamla başlamalı, kısa çizgiler ('-') içerebilir ve en fazla 35 karakter uzunluğunda olabilir.
 
 

39 satır
792 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 TaskGroup {
  6. id: number;
  7. name: string;
  8. }
  9. export interface Task {
  10. id: number;
  11. name: string;
  12. description: string | null;
  13. taskGroup: TaskGroup;
  14. }
  15. export interface TaskTemplate {
  16. id: number;
  17. code: string;
  18. name: string;
  19. }
  20. export const preloadTaskTemplates = () => {
  21. fetchTaskTemplates();
  22. };
  23. export const fetchTaskTemplates = cache(async () => {
  24. return serverFetchJson<TaskTemplate[]>(`${BASE_API_URL}/tasks/templates`);
  25. });
  26. export const preloadAllTasks = () => {
  27. fetchAllTasks();
  28. };
  29. export const fetchAllTasks = cache(async () => {
  30. return serverFetchJson<Task[]>(`${BASE_API_URL}/tasks`);
  31. });