diff --git a/lib/auth.tsx b/lib/auth.tsx index 70d41f8..1390e05 100644 --- a/lib/auth.tsx +++ b/lib/auth.tsx @@ -85,9 +85,11 @@ export const FirebaseGithubAuthProvider: React.FC<{ providerName: "GitHub", error, login: useCallback(() => { + setError(undefined); state && signInWithPopup(state.auth, state.provider).catch(handleError); }, [state]), logout: useCallback(() => { + setError(undefined); state && signOut(state.auth).catch(handleError); }, [state]), }; diff --git a/lib/pages/debug-page.tsx b/lib/pages/debug-page.tsx index ef25355..c9e797a 100644 --- a/lib/pages/debug-page.tsx +++ b/lib/pages/debug-page.tsx @@ -101,15 +101,20 @@ const AuthWidget: React.FC<{}> = () => { return null; } - if (ctx.error) { - return
{ctx.error}
; - } + const button = ctx.loggedInUser ? ( + + ) : ( + + ); - if (ctx.loggedInUser) { - return ; - } + const error = ctx.error ?{ctx.error}
: null; - return ; + return ( +