async function getSession() {
const cookieStore = await cookies();
const cookieHeader = cookieStore.toString();
try {
const session = await fetch(
`${process.env.NEXT_PUBLIC_API_URL}/api/auth/get-session`,
{
credentials: "include",
headers: {
Cookie: cookieHeader,
},
cache: "no-store",
}
);
if (!session.ok) return null;
return await session.json();
} catch (error) {
console.error("Session fetch error:", error);
return null;
}
}
async function getSession() {
const cookieStore = await cookies();
const cookieHeader = cookieStore.toString();
try {
const session = await fetch(
`${process.env.NEXT_PUBLIC_API_URL}/api/auth/get-session`,
{
credentials: "include",
headers: {
Cookie: cookieHeader,
},
cache: "no-store",
}
);
if (!session.ok) return null;
return await session.json();
} catch (error) {
console.error("Session fetch error:", error);
return null;
}
}