-
-
Save williamtran29/d3fe18ee044118c154704f0f3f0fe6d5 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