summaryrefslogtreecommitdiff
path: root/app/client/auth/auth.gate.js
diff options
context:
space:
mode:
Diffstat (limited to 'app/client/auth/auth.gate.js')
-rw-r--r--app/client/auth/auth.gate.js25
1 files changed, 11 insertions, 14 deletions
diff --git a/app/client/auth/auth.gate.js b/app/client/auth/auth.gate.js
index 07ab399..087dfc6 100644
--- a/app/client/auth/auth.gate.js
+++ b/app/client/auth/auth.gate.js
@@ -14,15 +14,21 @@ import { randint } from '../util/math'
class AuthRouter extends Component {
render(){
- console.log(this.props, Login)
return (
<BrowserRouter>
<div>
<div className="diamond"></div>
<Switch>
- <Route path='/logout' component={Logout} />
- <Route path='/signup' component={Signup} />
- <Route component={Login} />
+ <Route exact path='/' component={Login} />
+ <Route exact path='/login' component={Login} />
+ <Route exact path='/logout' component={Logout} />
+ <Route exact path='/signup' component={Signup} />
+ <Route component={props => {
+ this.props.actions.setReturnTo(props.location.pathname)
+ return (
+ <Redirect to="/login" />
+ )
+ }} />
</Switch>
</div>
</BrowserRouter>
@@ -35,12 +41,11 @@ class AuthRouter extends Component {
class AuthGate extends Component {
render(){
- console.log(this.props.auth)
if (!this.props.auth.initialized) {
return <div className='loading'>Loading</div>
}
if (this.props.auth.isAuthenticated) return <div>{this.props.children}</div>
- return <AuthRouter />
+ return <AuthRouter {...this.props} />
}
componentDidMount(){
this.props.actions.checkin()
@@ -56,11 +61,3 @@ const mapDispatchToProps = (dispatch) => ({
});
export default connect(mapStateToProps, mapDispatchToProps)(AuthGate);
-
- // <Route component={props => {
- // console.log(window.location.pathname)
- // this.props.actions.setReturnTo(window.location.pathname)
- // return (
- // <Redirect to="/login" />
- // )
- // }} /> \ No newline at end of file