Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 | 66x 66x 13x 53x 2x 51x 2x 49x | import { Button, Navbar } from "react-bootstrap";
import { Link } from "react-router-dom";
export default function GithubLogin({ currentUser, systemInfo }) {
var githubOauthLogin =
systemInfo?.githubOauthLogin || "/oauth2/authorization/github";
if (!currentUser || !currentUser.loggedIn) {
return <span data-testid="GithubLogin-logged-out" />;
}
// Add this null check for currentUser.root.user
if (!currentUser.root?.user) {
return <span data-testid="GithubLogin-loading" />;
}
if (currentUser.root.user.githubLogin) {
return (
<>
<Navbar.Text className="me-3" as={Link} to="/profile">
Github: {currentUser.root.user.githubLogin}
</Navbar.Text>
</>
);
}
return (
<>
<Button href={githubOauthLogin}>Connect Github</Button>
</>
);
}
|