diff options
Diffstat (limited to 'app/client/auth/auth.gate.js')
| -rw-r--r-- | app/client/auth/auth.gate.js | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/app/client/auth/auth.gate.js b/app/client/auth/auth.gate.js index 076ec54..40f244f 100644 --- a/app/client/auth/auth.gate.js +++ b/app/client/auth/auth.gate.js @@ -46,34 +46,36 @@ class AuthRouter extends Component { class AuthGate extends Component { render(){ - if (true && !this.props.auth.initialized) { + const { auth, env, actions } = this.props + if (env.production && !auth.initialized) { console.log('loading auth') return <div className='loading'>Loading</div> } - if (true || this.props.auth.isAuthenticated) { - console.log('authenticated...') - if (this.props.auth.returnTo) { - let { returnTo } = this.props.auth + if (env.development || auth.isAuthenticated) { + if (auth.returnTo) { + let { returnTo } = auth if (!returnTo || returnTo.match(/(login|logout|signup)/i)) { returnTo = '/' } console.log('history.push', returnTo) - this.props.actions.setReturnTo(null) + actions.setReturnTo(null) history.push(returnTo) return <div>Launching app</div> } - console.log('rendering as normal') return <div>{this.props.children}</div> } return <AuthRouter {...this.props} /> } componentDidMount(){ - this.props.actions.checkin() + if (this.props.env.production) { + this.props.actions.checkin() + } } } const mapStateToProps = (state) => ({ - auth: state.auth + env: state.system.env, + auth: state.auth, }); const mapDispatchToProps = (dispatch) => ({ |
