From 28d6dd9a097be3f76ede22f63c6c68a78607aec8 Mon Sep 17 00:00:00 2001 From: Jules Laplace Date: Sat, 22 Sep 2018 14:43:35 +0200 Subject: move fetch functionality into fileviweer --- app/client/auth/auth.gate.js | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) (limited to 'app/client/auth/auth.gate.js') 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
Loading
} - 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
Launching app
} - console.log('rendering as normal') return
{this.props.children}
} return } 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) => ({ -- cgit v1.2.3-70-g09d2