import { serverFetchJson } from "@/app/utils/fetchUtil"; import { BASE_API_URL } from "@/config/api"; import { cache } from "react"; import "server-only"; export interface TaskGroup { id: number; name: string; } export interface Task { id: number; name: string; description: string | null; taskGroup: TaskGroup; } export interface TaskTemplate { id: number; code: string; name: string; } export const preloadTaskTemplates = () => { fetchTaskTemplates(); }; export const fetchTaskTemplates = cache(async () => { return serverFetchJson(`${BASE_API_URL}/tasks/templates`); }); export const preloadAllTasks = () => { fetchAllTasks(); }; export const fetchAllTasks = cache(async () => { return serverFetchJson(`${BASE_API_URL}/tasks`); });