Guest User

Untitled

a guest
Jun 25th, 2018
114
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.43 KB | None | 0 0
  1. import React from 'react';
  2. import API from '../utils/API.js';
  3. import { Route, Redirect } from 'react-router-dom';
  4.  
  5. export const PrivateRoute = ({ component: Component, ...rest }) => (
  6. <Route {...rest} render={(props) => {
  7. var path = props.location.pathname;
  8. if(API.isAuth()===false){
  9. return(<Redirect to='/' />)
  10. }
  11. else{
  12. return( <Component {...props} /> )
  13. }
  14. }} />
  15. )
Add Comment
Please, Sign In to add comment