wip Pup 1.0.0
This commit is contained in:
commit
cdc15f019d
48 changed files with 1100 additions and 0 deletions
22
imports/ui/components/Public/Public.js
Normal file
22
imports/ui/components/Public/Public.js
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
import React, { PropTypes } from 'react';
|
||||
import { Route, Redirect } from 'react-router-dom';
|
||||
|
||||
const Public = ({ loggingIn, authenticated, component, ...rest }) => (
|
||||
<Route
|
||||
{...rest}
|
||||
render={(props) => {
|
||||
if (loggingIn) return <div />;
|
||||
return !authenticated ?
|
||||
(React.createElement(component, { ...props, loggingIn, authenticated })) :
|
||||
(<Redirect to="/documents" />);
|
||||
}}
|
||||
/>
|
||||
);
|
||||
|
||||
Public.propTypes = {
|
||||
loggingIn: PropTypes.bool.isRequired,
|
||||
authenticated: PropTypes.bool.isRequired,
|
||||
component: PropTypes.func.isRequired,
|
||||
};
|
||||
|
||||
export default Public;
|
||||
Loading…
Add table
Add a link
Reference in a new issue