Skip to content

Instantly share code, notes, and snippets.

@yathindrak
Last active June 18, 2022 08:34
Show Gist options
  • Save yathindrak/f3276482e35feeb73b911c9b381972c6 to your computer and use it in GitHub Desktop.
Save yathindrak/f3276482e35feeb73b911c9b381972c6 to your computer and use it in GitHub Desktop.
const { state, signIn, signOut } = useAuthContext();
.....
{
state?.isAuthenticated ?
(
<button
className="inline-flex items-center justify-center h-12 px-6 font-medium tracking-wide text-white transition duration-200 rounded shadow-md bg-deep-purple-accent-400 hover:bg-deep-purple-accent-700 focus:shadow-outline focus:outline-none"
aria-label="Sign up"
title="Sign up"
onClick={() => signOut()}
>
Sign Out
</button>
) :
(
<button
className="inline-flex items-center justify-center h-12 px-6 font-medium tracking-wide text-white transition duration-200 rounded shadow-md bg-deep-purple-accent-400 hover:bg-deep-purple-accent-700 focus:shadow-outline focus:outline-none"
aria-label="Sign up"
title="Sign up"
onClick={() => signIn()}
>
Sign In
</button>
)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment