diagnosing problem with session storage

This commit is contained in:
Mikayla Dobson
2023-01-13 21:26:56 -06:00
parent 3831f110a3
commit 7aa5e80d4d
20 changed files with 181 additions and 109 deletions

View File

@@ -4,7 +4,7 @@ import Divider from "../components/ui/Divider";
import { useAuthContext } from "../context/AuthContext";
import { ProtectPortal } from "./types";
const Protect: ProtectPortal = ({ children }) => {
const Protect: ProtectPortal = ({ children, redirect = '' }) => {
const { user } = useAuthContext();
const navigate = useNavigate();
@@ -15,7 +15,7 @@ const Protect: ProtectPortal = ({ children }) => {
<h1>Hi there! You don't look too familiar.</h1>
<p>To view the content on this page, please log in below:</p>
<Divider />
<Button onClick={() => navigate('/login')}>Log In</Button>
<Button onClick={() => navigate(redirect ? `/login?redirect=${redirect}` : '/login')}>Log In</Button>
</div>
</Page>
)