From ac1c910d5e574eb7b557ac4c7ea6130dff4a5fc4 Mon Sep 17 00:00:00 2001 From: Jakub Neander Date: Fri, 7 Jul 2023 11:20:35 +0200 Subject: [PATCH] Fix to clarify to wait for auth process to finish (#211) --- README.md | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 273abc48..f039df7d 100644 --- a/README.md +++ b/README.md @@ -51,7 +51,7 @@ ReactDOM.render( const App = () => { const { login } = useAuth(); - const { authenticated, user } = useAuthState(); + const { authenticated, user, authenticating } = useAuthState(); const handleSignIn = async () => { const { data } = await login({ @@ -70,8 +70,13 @@ const App = () => { } }; + // Important: wait till the authentication process finishes + if (authenticating) { + return
Loading...
+ } + if (authenticated && user) { - return Signed in as {user.firstName}; + return Signed in as {user.email}; } return ;