Skip to content

Instantly share code, notes, and snippets.

@Joshscorp
Created July 14, 2022 06:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Joshscorp/8b67298fd22de97fb49002053c74d5a9 to your computer and use it in GitHub Desktop.
Save Joshscorp/8b67298fd22de97fb49002053c74d5a9 to your computer and use it in GitHub Desktop.
OnzAuth App Js UI
return (
<div className="wrapper">
<h1>Application</h1>
<button onClick={() => {
if (isLoggingIn) {
handleCancelLogin();
return;
}
if (isLoggedIn) {
handleLogout();
} else {
handleLogin();
}
}}>
{isLoggingIn ? 'Cancel Log in' : (isLoggedIn ? 'Log out' : 'Log in')}
</button>
<div id="myLoginDiv"></div>
<Routes>
<Route path="/protected" element={
<ProtectedRoute user={user}>
<ProtectedPage user={user}/>
</ProtectedRoute>} />
<Route index element={
<PublicPage />
} />
</Routes>
</div>
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment