Skip to content

Instantly share code, notes, and snippets.

@mattmazzola
Created October 9, 2017 04:52
Show Gist options
  • Save mattmazzola/dcad539b3a32e389e1870f60b8e677c1 to your computer and use it in GitHub Desktop.
Save mattmazzola/dcad539b3a32e389e1870f60b8e677c1 to your computer and use it in GitHub Desktop.
authentication required
// tslint:disable-next-line:no-any
const userIsAuthenticated = connectedRouterRedirect<any, State>({
// The url to redirect user to if they fail
redirectPath: '/login',
// Determine if the user is authenticated or not
authenticatedSelector: state => state.user.isLoggedIn,
// A nice display name for this check
wrapperDisplayName: 'UserIsAuthenticated'
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment