useAuth
Hook with no arguments that returns two authentication functions used internally by React Bricks to execute the login and logout.
When using React Bricks admin components, there should be no need to call this from your code.
Example usage
Section titled “Example usage”const { loginUser, logoutUser } = useAuth()
loginUser
Section titled “loginUser”Function with the following signature:
const loginUser: (email: string, password: string) => Promise<any>
Example usage
Section titled “Example usage”const { loginUser } = useAuth()
const handleLogin = (event: React.FormEvent) => { event.preventDefault() loginUser(email, password).then( () => navigate(editorPath), (error) => { setError(error) } )}
logoutUser
Section titled “logoutUser”Function with the following signature:
const logoutUser: () => void
Example usage
Section titled “Example usage”const { logoutUser } = useAuth()return <button onClick={() => logoutUser()}>Logout</button>