import React from 'react'; import { Route, Redirect } from 'react-router-dom'; import history from '../history'; import { authenticationService } from '../_services'; export const PublicRoute = ({ component: Component, restricted, ...rest }) => ( { const currentUser = authenticationService.currentUserValue; if (currentUser) { //history.push("/dashboard"); // not logged in so redirect to login page with the return url return }else{ } // authorised so return component return }} /> )