import TurnsPage from "@/components/panel/turns"; import { cookies } from "next/headers"; import { fetchReq } from "@/lib/req"; import { safeJsonParse } from "@/lib/sanitize"; import { adaptRepresentationDashboard } from "@/lib/representationAdapters"; export const dynamic = "force-dynamic"; async function page() { const API_URL = process.env.NEXT_PUBLIC_API_URL; let dashboard = null; try { const cookieStore = await cookies(); const userInfo = cookieStore.get("userInfo"); const accessToken = cookieStore.get("access_token"); if (userInfo && accessToken) { const parsedUserInfo = safeJsonParse(userInfo.value); const representationUuid = parsedUserInfo?.representation_uuid; if (representationUuid) { const now = new Date(); const year = now.getFullYear(); const month = now.getMonth() + 1; dashboard = await fetchReq( `${API_URL}/api/v1/representation/${representationUuid}/dashboard/monthly?year=${year}&month=${month}`, { headers: { Authorization: `Bearer ${accessToken.value}` } } ); } } } catch (error) { console.error("Error fetching representation turns:", error); } return ; } export default page;