-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
signup & login functioning, authChecker implemented around main game
- Loading branch information
Jon Brennan
authored and
Jon Brennan
committed
Nov 15, 2023
1 parent
69f1850
commit 77a7672
Showing
4 changed files
with
120 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import React, { useEffect } from "react"; | ||
import { useNavigate } from "react-router-dom"; | ||
|
||
const AuthChecker = (props) => { | ||
const currentUser = localStorage.getItem("currentUser"); | ||
|
||
const navigate = useNavigate(); | ||
|
||
useEffect(() => { | ||
if (!currentUser) navigate("/auth"); | ||
}, [currentUser, navigate]); | ||
return <div>{props.children}</div>; | ||
}; | ||
|
||
export default AuthChecker; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters