Login/Auth and pariticipate. Telegram auth (wip)
This commit is contained in:
parent
91b4197b04
commit
4227389a67
14 changed files with 161 additions and 48 deletions
|
|
@ -2,14 +2,18 @@ import React from 'react';
|
|||
import PropTypes from 'prop-types';
|
||||
import { Route, Redirect } from 'react-router-dom';
|
||||
|
||||
const Public = ({ loggingIn, authenticated, component, path, exact, ...rest }) => (
|
||||
const Public = ({
|
||||
loggingIn, authenticated, component, location, path, exact, ...rest
|
||||
}) => (
|
||||
<Route
|
||||
path={path}
|
||||
exact={exact}
|
||||
render={props => (
|
||||
!authenticated ?
|
||||
(React.createElement(component, { ...props, ...rest, loggingIn, authenticated })) :
|
||||
(<Redirect to="/subscriptions" />)
|
||||
(React.createElement(component, {
|
||||
...props, ...rest, loggingIn, authenticated
|
||||
})) :
|
||||
(<Redirect to={{ pathname: '/subscriptions', state: location.state }} />)
|
||||
)}
|
||||
/>
|
||||
);
|
||||
|
|
@ -17,7 +21,7 @@ const Public = ({ loggingIn, authenticated, component, path, exact, ...rest }) =
|
|||
Public.propTypes = {
|
||||
loggingIn: PropTypes.bool.isRequired,
|
||||
authenticated: PropTypes.bool.isRequired,
|
||||
component: PropTypes.func.isRequired,
|
||||
component: PropTypes.func.isRequired
|
||||
};
|
||||
|
||||
export default Public;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue