Created
October 5, 2018 19:25
-
-
Save jepras/3432d62acb4606503895c2d3e1d1842c to your computer and use it in GitHub Desktop.
If isAuthenticated, then render component. If not redirect to login.
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
const SecretRoute = ({ component: Component, ...rest }) => ( | |
<Route {...rest} render={(props) => ( | |
AuthService.isAuthenticated === true | |
? <Component {...props} /> | |
: <Redirect to='/login' /> | |
)} /> | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment