"use server" import { serverFetchJson } from "@/app/utils/fetchUtil"; import { BASE_API_URL } from "@/config/api"; import { cache } from "react"; export interface comboProp { id: any; label: string; } export interface combo { records: comboProp[]; } export interface CreateDepartmentInputs { departmentCode: string; departmentName: string; description: string; } export const saveDepartment = async (data: CreateDepartmentInputs) => { return serverFetchJson(`${BASE_API_URL}/departments/new`, { method: "POST", body: JSON.stringify(data), headers: { "Content-Type": "application/json" }, }); }; export const fetchDepartmentCombo = cache(async () => { return serverFetchJson(`${BASE_API_URL}/departments/combo`, { next: { tags: ["department"] }, }); });