diff options
Diffstat (limited to 'app')
| -rw-r--r-- | app/client/auth/auth.gate.js | 25 | ||||
| -rw-r--r-- | app/client/index.jsx | 2 |
2 files changed, 12 insertions, 15 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 diff --git a/app/client/index.jsx b/app/client/index.jsx index 5bb84b7..0258a7a 100644 --- a/app/client/index.jsx +++ b/app/client/index.jsx @@ -29,10 +29,10 @@ const app = ( <Route exact path='/dashboard/' component={Dashboard} /> <Route exact path='/logout/' component={Auth.Logout} /> {module_list} - <Header /> <Route component={() => <Redirect to="/" />} /> </Switch> </BrowserRouter> + <Header /> <AudioPlayer /> </Auth.Gate> </Provider> |
