remove unnecessary loggingIn check when rendering authenticated and public routes

This commit is contained in:
cleverbeagle 2017-07-09 17:36:31 -05:00
parent 90e3a823c8
commit e763aebb11
3 changed files with 10 additions and 12 deletions

View file

@ -5,12 +5,11 @@ import { Route, Redirect } from 'react-router-dom';
const Authenticated = ({ loggingIn, authenticated, component, ...rest }) => (
<Route
{...rest}
render={(props) => {
if (loggingIn) return <div />;
return authenticated ?
render={props => (
authenticated ?
(React.createElement(component, { ...props, loggingIn, authenticated })) :
(<Redirect to="/logout" />);
}}
(<Redirect to="/logout" />)
)}
/>
);

View file

@ -5,12 +5,11 @@ import { Route, Redirect } from 'react-router-dom';
const Public = ({ loggingIn, authenticated, component, ...rest }) => (
<Route
{...rest}
render={(props) => {
if (loggingIn) return <div />;
return !authenticated ?
render={props => (
!authenticated ?
(React.createElement(component, { ...props, loggingIn, authenticated })) :
(<Redirect to="/documents" />);
}}
(<Redirect to="/documents" />)
)}
/>
);