Fix (!me) logic
This commit is contained in:
parent
d3952925d7
commit
cbf799d53f
3 changed files with 8 additions and 3 deletions
|
@ -39,6 +39,7 @@ const mapStateToProps = (state) => {
|
|||
|
||||
return {
|
||||
showIntroduction,
|
||||
me,
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -50,6 +51,8 @@ class GabSocialMount extends React.PureComponent {
|
|||
};
|
||||
|
||||
render () {
|
||||
const { me } = this.props;
|
||||
if (me == null) return null;
|
||||
// Disabling introduction for launch
|
||||
// const { showIntroduction } = this.props;
|
||||
//
|
||||
|
|
|
@ -72,7 +72,7 @@ class WrappedRoute extends React.Component {
|
|||
render () {
|
||||
const { component: Component, content, publicRoute, me, ...rest } = this.props;
|
||||
|
||||
if (!publicRoute && !me) {
|
||||
if (!publicRoute && me == false) {
|
||||
const actualUrl = encodeURIComponent(this.props.computedMatch.url);
|
||||
return <Route path={this.props.path} component={() => {
|
||||
window.location.href = `/auth/sign_in?redirect_uri=${actualUrl}`;
|
||||
|
|
|
@ -1,12 +1,14 @@
|
|||
import { ME_FETCH_SUCCESS } from '../actions/me';
|
||||
import { ME_FETCH_SUCCESS, ME_FETCH_FAIL } from '../actions/me';
|
||||
import { Map as ImmutableMap, fromJS } from 'immutable';
|
||||
|
||||
const initialState = ImmutableMap();
|
||||
const initialState = null;
|
||||
|
||||
export default function me(state = initialState, action) {
|
||||
switch(action.type) {
|
||||
case ME_FETCH_SUCCESS:
|
||||
return fromJS(action.me.id);
|
||||
case ME_FETCH_FAIL:
|
||||
return false;
|
||||
default:
|
||||
return state;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue