#21 Using wouter for navigation and links. Register page works by sending request to register endpoint

This commit is contained in:
2023-03-19 16:34:44 -04:00
parent 0d4c4facd5
commit f6e2b445d7
7 changed files with 235 additions and 46 deletions

View File

@@ -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>