import React from "react"; import { Redirect, Route } from "react-router"; export default function AuthRoute({ children, ...rest }) { // TODO: replace with actual Auth data from redux later const auth = true; return ( { console.log(location); if (auth) { if (location.pathname === "/login") { return ; } else { return children; } } else if (location.pathname !== "/login") { return ; } return children; }} /> ); }