remove unnecessary loggingIn check when rendering authenticated and public routes
This commit is contained in:
parent
90e3a823c8
commit
e763aebb11
3 changed files with 10 additions and 12 deletions
|
|
@ -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" />)
|
||||
)}
|
||||
/>
|
||||
);
|
||||
|
||||
|
|
|
|||
|
|
@ -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" />)
|
||||
)}
|
||||
/>
|
||||
);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue