Closed koistya closed 2 years ago
Add AuthProvider component and useAuth() Rreact hook for handling authentication. Usage example:
AuthProvider
useAuth()
improt { useAuth, LoginMethod } from "../core"; function Example(): JSX.Element { const auth = useAuth(); function signIn() { auth.signIn({ method: LoginMethod.Google }).then(user => { ... }); } return ( <div> <button onClick={signIn}> Continue with Google </button> </div> ); }
improt { useAuth } from "../core"; function Example(): JSX.Element { const { me, ...auth } = useAuth(); function handleClick() { auth.signOut().then(()=> { ... }); } return ( <div> <span>Welcome, {me.name}!</span> <button onClick={signOut}> Sign Out </button> </div> ); }
Add
AuthProvider
component anduseAuth()
Rreact hook for handling authentication. Usage example: