import { serverFetchJson } from "@/app/utils/fetchUtil"; import { BASE_API_URL } from "@/config/api"; import { cache } from "react"; import "server-only"; export interface Staff { id: number; name: string; staffId: string; team: { name: string; code: string; }; } export interface StaffResult { id: number; name: string; team: string; staffId: string; grade: string; joinPosition: string; currentPosition: string; } export interface searchInput { staffId: string; name: string; team: string; grade: string; currentPosition: string; } export const preloadTeamLeads = () => { fetchTeamLeads(); // fetchStaff(); }; export const fetchTeamLeads = cache(async () => { return serverFetchJson(`${BASE_API_URL}/staffs/teamLeads`, { next: { tags: ["teamLeads"] }, }); }); export const preloadStaff = () => { fetchStaff(); }; export const fetchStaff = cache(async () => { return serverFetchJson(`${BASE_API_URL}/staffs`, { next: { tags: ["staffs"] }, }); });