diff options
| author | Jules Laplace <julescarbon@gmail.com> | 2018-09-22 14:43:35 +0200 |
|---|---|---|
| committer | Jules Laplace <julescarbon@gmail.com> | 2018-09-22 14:43:35 +0200 |
| commit | 28d6dd9a097be3f76ede22f63c6c68a78607aec8 (patch) | |
| tree | e089c8d43ecfe944427e61e258c39a177cfc9b1f /app/client/auth | |
| parent | 112b15b5918296f159af79e1f6db96beac7aa14d (diff) | |
move fetch functionality into fileviweer
Diffstat (limited to 'app/client/auth')
| -rw-r--r-- | app/client/auth/auth.gate.js | 20 | ||||
| -rw-r--r-- | app/client/auth/auth.reducer.js | 1 |
2 files changed, 11 insertions, 10 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) => ({ diff --git a/app/client/auth/auth.reducer.js b/app/client/auth/auth.reducer.js index a56f94a..80b1ec5 100644 --- a/app/client/auth/auth.reducer.js +++ b/app/client/auth/auth.reducer.js @@ -11,7 +11,6 @@ const authInitialState = { } const auth = (state = authInitialState, action) => { - console.log(action) switch(action.type) { case types.auth.set_token: return { |
