AutorÃa | Ultima modificación | Ver Log |
import React from 'react'
import { Route, Redirect } from 'react-router-dom'
const PublicRoute = ({ children, isAuthenticated, ...rest }) => {
return (
<Route
{...rest}
render={({ location }) =>
isAuthenticated ? (
<Redirect
to={{
pathname: '/dashboard',
state: { from: location },
}}
/>
) : (
children
)
}
/>
)
}
export default PublicRoute