Commit d996804a authored by Ben Anderson's avatar Ben Anderson

Removed broken auth

parent 77ecc740
This diff is collapsed.
import {useEffect, useContext} from "react"; import { useEffect, useContext } from "react";
import React from "react"; import React from "react";
import { Redirect, Route } from "react-router"; import { Redirect, Route } from "react-router";
import {AuthContext} from '../App'; import { AuthContext } from "../App";
export default function AuthRoute({children, ...rest}) {
const { isLoggedIn } = useContext(AuthContext)
export default function AuthRoute({ children, ...rest }) {
const { isLoggedIn } = useContext(AuthContext);
return ( return (
<Route <Route
...@@ -14,12 +12,14 @@ export default function AuthRoute({children, ...rest}) { ...@@ -14,12 +12,14 @@ export default function AuthRoute({children, ...rest}) {
render={({ location }) => { render={({ location }) => {
if (isLoggedIn) { if (isLoggedIn) {
if (location.pathname === "/login") { if (location.pathname === "/login") {
return <Redirect to="/" />; // return <Redirect to="/" />;
return children;
} else { } else {
return children; return children;
} }
} else if (location.pathname !== "/login") { } else if (location.pathname !== "/login") {
return <Redirect to="/login" />; // return <Redirect to="/login" />;
return children;
} }
return children; return children;
}} }}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment