Redux: how to use the Store.auth on .onEnter of React-router

Created on 17 Jul 2015  路  6Comments  路  Source: reduxjs/redux

Can you give me some advice. Thank you very much

export default class Home extends React.Component {
...
}

Home.onEnter = function(next, transition) {
    if(!store.auth) {
         // transition.to('/sigin');
    }
}
help wanted

All 6 comments

thanks @emmenko

:+1:

So that link is dead. Any chance on anyone having an updated link or an example? In the onEnter, I'm trying to dispatch an action to sync the "active user" (whoever is logged in at that moment), listen for a single update after the action is dispatched, then unsubscribe once I get the response. I tried making the initial store object accessible in a separate module and then referencing that object but this led to unexpected store updates. Any help would be greatly appreciated!

@jljorgenson18

Please ask this on StackOverflow.
It's a better place for such questions.

Was this page helpful?
0 / 5 - 0 ratings