© 2026 Hedgehog Software, LLC
const session = await authClient.getSession(); const isAuthenticated = () => { console.log(session); return !!session.data; };
/get-session
session
{ data: null, error: null }
import GlobalModal from "@/components/global-modal"; import GlobalSearch from "@/components/global-search"; import Sidebar from "@/components/sidebar"; import BottomTab from "@/components/bottom-tab"; import { createFileRoute, Outlet, redirect } from "@tanstack/react-router"; import { authClient } from "@/lib/auth-client"; const session = await authClient.getSession(); const isAuthenticated = () => { console.log(session); return !!session.data; }; export const Route = createFileRoute("/_authed")({ beforeLoad: async ({ location }) => { if (!isAuthenticated()) { throw redirect({ to: "/login", search: { redirect: location.href, }, }); } }, component: () => { return <Outlet />; }, });