import Link from "next/link"; import { Button } from "./ui/button"; import { auth } from "@/lib/auth"; import { headers } from "next/headers"; export async function SignInButton() { const session = await auth.api.getSession({ headers: await headers(), }); return ( ); } function checkOptimisticSession(headers: Headers) { const guessIsSignIn = headers.get("cookie")?.includes("better-auth.session") || headers.get("cookie")?.includes("__Secure-better-auth.session-token"); return !!guessIsSignIn; } export function SignInFallback() { //to avoid flash of unauthenticated state const guessIsSignIn = checkOptimisticSession(headers()); return ( ); }