summaryrefslogtreecommitdiff
path: root/app/client/auth
diff options
context:
space:
mode:
Diffstat (limited to 'app/client/auth')
-rw-r--r--app/client/auth/auth.gate.js20
-rw-r--r--app/client/auth/auth.reducer.js1
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 {