import { cache } from "react";
import { serverFetchJson } from "@/app/utils/fetchUtil";
import { BASE_API_URL } from "@/config/api";
import "server-only";

export interface TeamProjectResult {
  id: number;
  teamId: number;
  teamLeadId: number;
  teamCode: string;
  teamName: string;
  projectNo: number;
}

export const preloadProjects = () => {
  fetchTeamProjects();
};

export const fetchTeamProjects = cache(async () => {
  return serverFetchJson<TeamProjectResult[]>(`${BASE_API_URL}/dashboard/searchTeamProjectNo`);
});

