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
|
|
@ -38,7 +38,7 @@ es5-shim@4.6.15
|
|||
facebook-oauth@1.3.1
|
||||
fastclick@1.0.13
|
||||
fortawesome:fontawesome@4.7.0
|
||||
fourseven:scss@4.5.0
|
||||
fourseven:scss@4.5.4
|
||||
geojson-utils@1.0.10
|
||||
github-oauth@1.2.0
|
||||
google-oauth@1.2.4
|
||||
|
|
@ -93,7 +93,7 @@ templating@1.3.2
|
|||
templating-compiler@1.3.2
|
||||
templating-runtime@1.3.2
|
||||
templating-tools@1.1.2
|
||||
themeteorchef:bert@2.1.2
|
||||
themeteorchef:bert@2.1.3
|
||||
tmeasday:check-npm-versions@0.3.1
|
||||
tracker@1.1.3
|
||||
twbs:bootstrap@3.3.6
|
||||
|
|
|
|||
|
|
@ -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