codefordenver/encorelink

login redirect broken

Closed this issue · 1 comments

after filling out log in form, the page stays on login instead of redirecting

In my initial investigation (and I am still a React n00b) on the issue, it seems that the .componentWillReceiveProps(nextProps) (Ln30 of ) method within Register.js isn't receiving the properties it needs to redirect to the /events page. I placed console logging statements in the areas below:

  componentWillReceiveProps(nextProps) {
    console.log("this.props...." + JSON.stringify(this.props))
    console.log("nextProps...." + JSON.stringify(nextProps))
    if (nextProps.isLoggedIn) {
      if (nextProps.isMusician) {
        this.props.router.push('/events');
      } else {
        this.props.router.push('/createEvent');
      }
    }

and got the following in my browser console (spaces added for readability):

core.js:102  action REGISTER_REQUEST @ 21:59:41.053 (in 0.28 ms)

core.js:102  action REGISTER_SUCCESS @ 21:59:41.178 (in 0.14 ms)
Register.js:69 this.props....{"isFetching":false,"router":{"__v2_compatible__":true}}
Register.js:70 nextProps....{"isFetching":true,"router":{"__v2_compatible__":true}}

core.js:102  action LOGIN_REQUEST @ 21:59:41.181 (in 3.34 ms)
Register.js:69 this.props....{"isFetching":true,"router":{"__v2_compatible__":true}}
Register.js:70 nextProps....{"isFetching":false,"router":{"__v2_compatible__":true}}

core.js:102  action LOGIN_SUCCESS @ 21:59:41.315 (in 6.22 ms)

Seems like some of the state exchanged between the reducers REGISTER_SUCCESS and LOGIN_REQUEST is no longer taking place. Will continue to look into it, but wanted to jot this down.