daily pastebin goal
28%
SHARE
TWEET

Untitled

a guest Jun 25th, 2018 72 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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. )
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top