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;
|
||||
|
|
|
|||
|
|
@ -74,7 +74,7 @@ class SelectionMap extends Component {
|
|||
|
||||
onFstBtn() {
|
||||
this.props.onFstBtn({
|
||||
location: { lat: this.state.center[0], lon: this.state.center[1] },
|
||||
location: { lat: this.state.marker[0], lon: this.state.marker[1] },
|
||||
distance: this.state.distance
|
||||
});
|
||||
}
|
||||
|
|
@ -113,7 +113,7 @@ class SelectionMap extends Component {
|
|||
|
||||
fit() {
|
||||
// console.log("fit!");
|
||||
if (this.props.currentSubs.length > 0 && this.state.subsFit) {
|
||||
if (this.props.currentSubs.length > 0 && this.state.subsFit && this.props.action !== action.add) {
|
||||
// has autofit, do nothing
|
||||
} else if (this.selectionMap && this.distanceCircle) {
|
||||
if (!this.getMap().getBounds().contains(this.distanceCircle.leafletElement.getBounds())) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue