import React from "react"; import { fetchAllCustomers } from "@/app/api/customer"; import { fetchIndivTeam, fetchTeam } from "@/app/api/team"; import CostAndExpenseReport from "./CostAndExpenseReport"; import CostAndExpenseReportLoading from "./CostAndExpenseReportLoading"; import { headers, cookies } from 'next/headers'; import { getServerSession } from "next-auth"; import { authOptions } from "@/config/authConfig"; import { TEAM_LEAD } from "@/middleware"; interface SubComponents { Loading: typeof CostAndExpenseReportLoading; } const CostAndExpenseReportWrapper: React.FC & SubComponents = async () => { const session: any = await getServerSession(authOptions) const teamId = session.staff?.team.id const role = session.role let customers = await fetchAllCustomers() let teams = await fetchTeam() let needAll = true if (role === TEAM_LEAD) { needAll = false teams = teams.filter((team) => team.id === teamId); } return }; CostAndExpenseReportWrapper.Loading = CostAndExpenseReportLoading; export default CostAndExpenseReportWrapper;