import { auth } from "./auth";
import { headers } from "next/headers";
export default async function Page() {
const session = await auth.api.getSession({ headers: await headers() });
if (!session) {
redirect("/auth/sign-in");
}
console.log(session) // user is sometimes undefined inside session, why?
// ...rest of component
}
import { auth } from "./auth";
import { headers } from "next/headers";
export default async function Page() {
const session = await auth.api.getSession({ headers: await headers() });
if (!session) {
redirect("/auth/sign-in");
}
console.log(session) // user is sometimes undefined inside session, why?
// ...rest of component
}