Skip to content

Instantly share code, notes, and snippets.

@slightlytyler
Created July 13, 2017 03:26
Show Gist options
  • Save slightlytyler/6fce8a4eb2d7785399dd0b00bcbdfc9d to your computer and use it in GitHub Desktop.
Save slightlytyler/6fce8a4eb2d7785399dd0b00bcbdfc9d to your computer and use it in GitHub Desktop.
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