#21 Using wouter for navigation and links. Register page works by sending request to register endpoint
This commit is contained in:
@@ -6,18 +6,12 @@ import UserContext from "../contexts/UserContext";
|
||||
const HomePage = () => {
|
||||
const { currentUser } = useContext(UserContext);
|
||||
|
||||
useEffect(() => {
|
||||
if (!currentUser?.id) {
|
||||
window.location.replace("/login");
|
||||
}
|
||||
}, [currentUser]);
|
||||
|
||||
return (
|
||||
<div>
|
||||
<MyNavbar />
|
||||
<Container>
|
||||
<Container className="p-5">
|
||||
<div>
|
||||
<h1>This is the home page</h1>
|
||||
<h1>Welcome back {currentUser?.username}!</h1>
|
||||
</div>
|
||||
</Container>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user