SHARE
TWEET

Untitled

a guest Aug 21st, 2019 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
  7.     {...rest}
  8.     render={(props) => {
  9.       if (API.isAuth() === false) {
  10.         return <Redirect to="/" />;
  11.       } else {
  12.         return <Component {...props} />;
  13.       }
  14.     }}
  15.   />
  16. );
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