Skip to content

Instantly share code, notes, and snippets.

@Olgagr
Created November 7, 2015 13:37
Show Gist options
  • Save Olgagr/68b26eacc2dd4bc5178b to your computer and use it in GitHub Desktop.
Save Olgagr/68b26eacc2dd4bc5178b to your computer and use it in GitHub Desktop.
react authorization
requireAuth: function(nextState, replaceState) {
if (!AuthStore.isAuthenticated()) {
replaceState({ nextPathname: nextState.location.pathname }, '/');
}
},
render: function() {
return (
<Layout>
<Router history={history}>
<Route path="/" component={LoginFrom}/>
<Route path="profiles" component={ProfilesList} onEnter={this.requireAuth}/>
</Router>
</Layout>
);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment