Created
July 13, 2017 03:26
-
-
Save slightlytyler/6fce8a4eb2d7785399dd0b00bcbdfc9d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { compliment, compose, get } from 'lodash/fp'; | |
import { connect } from 'react-redux'; | |
import { branch, renderComponent } from 'recompose'; | |
const selectIsAuthenticated = state => ({ | |
isAuthenticated: Boolean(state.currentUser), | |
}); | |
const withAuth = compose( | |
connect(selectAuthorizationStatus), | |
branch( | |
compose(compliment, get)('isAuthenticated'), | |
renderComponent(Login), | |
), | |
); | |
export default withAuth |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment