Hook for authentication. Provides user state and auth actions.
function LoginPage() { const { signIn, isLoading } = useAuth(); const handleSubmit = async (email, password) => { const { error } = await signIn(email, password); if (error) alert(error.message); };} Copy
function LoginPage() { const { signIn, isLoading } = useAuth(); const handleSubmit = async (email, password) => { const { error } = await signIn(email, password); if (error) alert(error.message); };}
function Navbar() { const { user, isAuthenticated, signOut } = useAuth(); if (!isAuthenticated) return <Link to="/login">Sign In</Link>; return <button onClick={signOut}>{user.email}</button>;} Copy
function Navbar() { const { user, isAuthenticated, signOut } = useAuth(); if (!isAuthenticated) return <Link to="/login">Sign In</Link>; return <button onClick={signOut}>{user.email}</button>;}
Hook for authentication. Provides user state and auth actions.