better-auth/apps/web/modules/saas/auth/hooks/use-session.ts

13 lines
318 B
TypeScript
Raw Normal View History

2025-10-29 13:43:43 +05:00
import { useContext } from "react";
import { SessionContext } from "../lib/session-context";
export const useSession = () => {
const sessionContext = useContext(SessionContext);
if (sessionContext === undefined) {
throw new Error("useSession must be used within SessionProvider");
}
return sessionContext;
};