From 7360a43898878f3ce7314841c8daf7ee60c7c24f Mon Sep 17 00:00:00 2001 From: Chi Vinh Le Date: Fri, 11 Aug 2017 22:50:12 +0700 Subject: [PATCH] Remove immutable from embed stream --- .../containers/ConfigureStreamContainer.js | 2 +- .../src/containers/Embed.js | 2 +- .../src/containers/Stream.js | 5 +- .../coral-embed-stream/src/graphql/index.js | 6 +- client/coral-framework/actions/asset.js | 4 +- client/coral-framework/actions/auth.js | 27 +- client/coral-framework/actions/user.js | 21 -- client/coral-framework/constants/assets.js | 3 - client/coral-framework/constants/user.js | 10 - client/coral-framework/reducers/asset.js | 19 +- client/coral-framework/reducers/auth.js | 281 +++++++++++------- client/coral-framework/reducers/index.js | 2 - client/coral-framework/reducers/user.js | 43 --- .../containers/ProfileContainer.js | 11 +- plugin-api/beta/client/hocs/withReaction.js | 2 +- plugin-api/beta/client/hocs/withTags.js | 2 +- .../client/components/ChangeUsername.js | 2 +- .../client/components/SignInButton.js | 2 +- .../client/components/SignInContainer.js | 2 +- .../client/components/UserBox.js | 4 +- 20 files changed, 236 insertions(+), 214 deletions(-) delete mode 100644 client/coral-framework/actions/user.js delete mode 100644 client/coral-framework/constants/assets.js delete mode 100644 client/coral-framework/constants/user.js delete mode 100644 client/coral-framework/reducers/user.js diff --git a/client/coral-configure/containers/ConfigureStreamContainer.js b/client/coral-configure/containers/ConfigureStreamContainer.js index e7b937030..8489c809f 100644 --- a/client/coral-configure/containers/ConfigureStreamContainer.js +++ b/client/coral-configure/containers/ConfigureStreamContainer.js @@ -119,7 +119,7 @@ class ConfigureStreamContainer extends Component { } const mapStateToProps = (state) => ({ - asset: state.asset.toJS() + asset: state.asset }); const mapDispatchToProps = (dispatch) => ({ diff --git a/client/coral-embed-stream/src/containers/Embed.js b/client/coral-embed-stream/src/containers/Embed.js index 06646a6c2..e21a683d1 100644 --- a/client/coral-embed-stream/src/containers/Embed.js +++ b/client/coral-embed-stream/src/containers/Embed.js @@ -170,7 +170,7 @@ export const withEmbedQuery = withQuery(EMBED_QUERY, { }); const mapStateToProps = (state) => ({ - auth: state.auth.toJS(), + auth: state.auth, commentId: state.stream.commentId, assetId: state.stream.assetId, assetUrl: state.stream.assetUrl, diff --git a/client/coral-embed-stream/src/containers/Stream.js b/client/coral-embed-stream/src/containers/Stream.js index 73676713c..451b115a9 100644 --- a/client/coral-embed-stream/src/containers/Stream.js +++ b/client/coral-embed-stream/src/containers/Stream.js @@ -10,7 +10,6 @@ import { import * as authActions from 'coral-framework/actions/auth'; import * as notificationActions from 'coral-framework/actions/notification'; -import {editName} from 'coral-framework/actions/user'; import {setActiveReplyBox, setActiveTab, viewAllComments} from '../actions/stream'; import Stream from '../components/Stream'; import Comment from './Comment'; @@ -26,7 +25,7 @@ import { } from '../graphql/utils'; import omit from 'lodash/omit'; -const {showSignInDialog} = authActions; +const {showSignInDialog, editName} = authActions; const {addNotification} = notificationActions; class StreamContainer extends React.Component { @@ -298,7 +297,7 @@ const fragments = { }; const mapStateToProps = (state) => ({ - auth: state.auth.toJS(), + auth: state.auth, refetching: state.embed.refetching, commentCountCache: state.stream.commentCountCache, activeReplyBox: state.stream.activeReplyBox, diff --git a/client/coral-embed-stream/src/graphql/index.js b/client/coral-embed-stream/src/graphql/index.js index f52cc4e7d..4cd4a5d23 100644 --- a/client/coral-embed-stream/src/graphql/index.js +++ b/client/coral-embed-stream/src/graphql/index.js @@ -147,8 +147,8 @@ const extension = { __typename: 'Comment', user: { __typename: 'User', - id: auth.toJS().user.id, - username: auth.toJS().user.username + id: auth.user.id, + username: auth.user.username }, created_at: new Date().toISOString(), body, @@ -162,7 +162,7 @@ const extension = { __typename: 'Tag' }, assigned_by: { - id: auth.toJS().user.id, + id: auth.user.id, __typename: 'User' }, __typename: 'TagLink' diff --git a/client/coral-framework/actions/asset.js b/client/coral-framework/actions/asset.js index 24739ddde..aab3caf3a 100644 --- a/client/coral-framework/actions/asset.js +++ b/client/coral-framework/actions/asset.js @@ -13,7 +13,7 @@ const updateAssetSettingsSuccess = (settings) => ({type: actions.UPDATE_ASSET_SE const updateAssetSettingsFailure = (error) => ({type: actions.UPDATE_ASSET_SETTINGS_FAILURE, error}); export const updateConfiguration = (newConfig) => (dispatch, getState) => { - const assetId = getState().asset.toJS().id; + const assetId = getState().asset.id; dispatch(updateAssetSettingsRequest()); coralApi(`/assets/${assetId}/settings`, {method: 'PUT', body: newConfig}) .then(() => { @@ -27,7 +27,7 @@ export const updateConfiguration = (newConfig) => (dispatch, getState) => { }; export const updateOpenStream = (closedBody) => (dispatch, getState) => { - const assetId = getState().asset.toJS().id; + const assetId = getState().asset.id; dispatch(fetchAssetRequest()); coralApi(`/assets/${assetId}/status`, {method: 'PUT', body: closedBody}) .then(() => { diff --git a/client/coral-framework/actions/auth.js b/client/coral-framework/actions/auth.js index f4cf5217e..7c6d3bf89 100644 --- a/client/coral-framework/actions/auth.js +++ b/client/coral-framework/actions/auth.js @@ -4,6 +4,7 @@ import * as actions from '../constants/auth'; import * as Storage from '../helpers/storage'; import coralApi, {base} from '../helpers/request'; import pym from '../services/pym'; +import {addNotification} from '../actions/notification'; import {resetWebsocket} from 'coral-framework/services/client'; import t from 'coral-framework/services/i18n'; @@ -220,7 +221,7 @@ const signUpSuccess = (user) => ({type: actions.FETCH_SIGNUP_SUCCESS, user}); const signUpFailure = (error) => ({type: actions.FETCH_SIGNUP_FAILURE, error}); export const fetchSignUp = (formData) => (dispatch, getState) => { - const redirectUri = getState().auth.toJS().redirectUri; + const redirectUri = getState().auth.redirectUri; dispatch(signUpRequest()); coralApi('/users', { @@ -257,7 +258,7 @@ const forgotPasswordFailure = (error) => ({ export const fetchForgotPassword = (email) => (dispatch, getState) => { dispatch(forgotPasswordRequest(email)); - const redirectUri = getState().auth.toJS().redirectUri; + const redirectUri = getState().auth.redirectUri; coralApi('/account/password/reset', { method: 'POST', body: {email, loc: redirectUri} @@ -351,7 +352,7 @@ const verifyEmailFailure = () => ({ }); export const requestConfirmEmail = (email) => (dispatch, getState) => { - const redirectUri = getState().auth.toJS().redirectUri; + const redirectUri = getState().auth.redirectUri; dispatch(verifyEmailRequest()); return coralApi('/users/resend-verify', { method: 'POST', @@ -378,3 +379,23 @@ export const setRedirectUri = (uri) => ({ type: actions.SET_REDIRECT_URI, uri, }); + +//============================================================================== +// Edit Username +//============================================================================== + +const editUsernameFailure = (error) => ({type: actions.EDIT_USERNAME_FAILURE, error}); +const editUsernameSuccess = () => ({type: actions.EDIT_USERNAME_SUCCESS}); + +export const editName = (username) => (dispatch) => { + return coralApi('/account/username', {method: 'PUT', body: {username}}) + .then(() => { + dispatch(editUsernameSuccess()); + dispatch(addNotification('success', t('framework.success_name_update'))); + }) + .catch((error) => { + console.error(error); + const errorMessage = error.translation_key ? t(`error.${error.translation_key}`) : error.toString(); + dispatch(editUsernameFailure(errorMessage)); + }); +}; diff --git a/client/coral-framework/actions/user.js b/client/coral-framework/actions/user.js deleted file mode 100644 index a6ad45d4a..000000000 --- a/client/coral-framework/actions/user.js +++ /dev/null @@ -1,21 +0,0 @@ -import {addNotification} from '../actions/notification'; -import coralApi from '../helpers/request'; -import * as actions from '../constants/auth'; - -import t from 'coral-framework/services/i18n'; - -const editUsernameFailure = (error) => ({type: actions.EDIT_USERNAME_FAILURE, error}); -const editUsernameSuccess = () => ({type: actions.EDIT_USERNAME_SUCCESS}); - -export const editName = (username) => (dispatch) => { - return coralApi('/account/username', {method: 'PUT', body: {username}}) - .then(() => { - dispatch(editUsernameSuccess()); - dispatch(addNotification('success', t('framework.success_name_update'))); - }) - .catch((error) => { - console.error(error); - const errorMessage = error.translation_key ? t(`error.${error.translation_key}`) : error.toString(); - dispatch(editUsernameFailure(errorMessage)); - }); -}; diff --git a/client/coral-framework/constants/assets.js b/client/coral-framework/constants/assets.js deleted file mode 100644 index 3883ee835..000000000 --- a/client/coral-framework/constants/assets.js +++ /dev/null @@ -1,3 +0,0 @@ -export const MULTIPLE_ASSETS_REQUEST = 'MULTIPLE_ASSETS_REQUEST'; -export const MULTIPLE_ASSETS_SUCCESS = 'MULTIPLE_ASSETS_SUCCESS'; -export const MULTIPLE_ASSSETS_FAILURE = 'MULTIPLE_ASSSETS_FAILURE'; diff --git a/client/coral-framework/constants/user.js b/client/coral-framework/constants/user.js deleted file mode 100644 index 1557a42c9..000000000 --- a/client/coral-framework/constants/user.js +++ /dev/null @@ -1,10 +0,0 @@ -export const EDIT_NAME_REQUEST = 'EDIT_NAME_REQUEST'; -export const EDIT_NAME_SUCCESS = 'EDIT_NAME_SUCCESS'; -export const EDIT_NAME_FAILURE = 'EDIT_NAME_FAILURE'; -export const COMMENTS_BY_USER_REQUEST = 'COMMENTS_BY_USER_REQUEST'; -export const COMMENTS_BY_USER_SUCCESS = 'COMMENTS_BY_USER_SUCCESS'; -export const COMMENTS_BY_USER_FAILURE = 'COMMENTS_BY_USER_FAILURE'; -export const LOGOUT_SUCCESS = 'LOGOUT_SUCCESS'; -export const UPDATE_USERNAME = 'UPDATE_USERNAME'; -export const IGNORE_USER_SUCCESS = 'IGNORE_USER_SUCCESS'; -export const STOP_IGNORING_USER_SUCCESS = 'STOP_IGNORING_USER_SUCCESS'; diff --git a/client/coral-framework/reducers/asset.js b/client/coral-framework/reducers/asset.js index f9d0a55e3..b9837eddd 100644 --- a/client/coral-framework/reducers/asset.js +++ b/client/coral-framework/reducers/asset.js @@ -1,24 +1,27 @@ -import {Map} from 'immutable'; import * as actions from '../constants/asset'; -const initialState = Map({ +const initialState = { closedAt: null, settings: null, title: null, url: null, - features: Map({}), + features: {}, status: 'open', moderation: null -}); +}; export default function asset (state = initialState, action) { switch (action.type) { case actions.FETCH_ASSET_SUCCESS: - return state - .merge(action.asset); + return { + ...state, + ...action.asset, + }; case actions.UPDATE_ASSET_SETTINGS_SUCCESS: - return state - .setIn(['settings'], action.settings); + return { + ...state, + settings: action.settings, + }; default: return state; } diff --git a/client/coral-framework/reducers/auth.js b/client/coral-framework/reducers/auth.js index 5481b7a5e..1e18ddffa 100644 --- a/client/coral-framework/reducers/auth.js +++ b/client/coral-framework/reducers/auth.js @@ -1,8 +1,7 @@ -import {Map, fromJS} from 'immutable'; import * as actions from '../constants/auth'; import pym from 'coral-framework/services/pym'; -const initialState = Map({ +const initialState = { isLoading: false, loggedIn: false, user: null, @@ -21,27 +20,34 @@ const initialState = Map({ fromSignUp: false, requireEmailConfirmation: false, redirectUri: pym.parentUrl || location.href, -}); +}; const purge = (user) => { - const {settings, profiles, ...userData} = user; // eslint-disable-line - return fromJS(userData); + const {settings, ...userData} = user; // eslint-disable-line + return userData; }; export default function auth (state = initialState, action) { switch (action.type) { case actions.FOCUS_SIGNIN_DIALOG: - return state - .set('signInDialogFocus', true); + return { + ...state, + signInDialogFocus: true, + }; case actions.BLUR_SIGNIN_DIALOG: - return state - .set('signInDialogFocus', false); - case actions.SHOW_SIGNIN_DIALOG : - return state - .set('showSignInDialog', true) - .set('signInDialogFocus', true); + return { + ...state, + signInDialogFocus: false, + }; + case actions.SHOW_SIGNIN_DIALOG: + return { + ...state, + showSignInDialog: true, + signInDialogFocus: true, + }; case actions.HIDE_SIGNIN_DIALOG : - return state.merge(Map({ + return { + ...state, isLoading: false, showSignInDialog: false, signInDialogFocus: false, @@ -53,125 +59,198 @@ export default function auth (state = initialState, action) { emailVerificationSuccess: false, emailVerificationLoading: false, successSignUp: false - })); - case actions.SHOW_CREATEUSERNAME_DIALOG : - return state - .set('showCreateUsernameDialog', true); - case actions.HIDE_CREATEUSERNAME_DIALOG : - return state.merge(Map({ - showCreateUsernameDialog: false - })); - case actions.CREATE_USERNAME_SUCCESS : - return state.merge(Map({ + }; + case actions.SHOW_CREATEUSERNAME_DIALOG: + return { + ...state, + showCreateUsernameDialog: true, + }; + case actions.HIDE_CREATEUSERNAME_DIALOG: + return { + ...state, showCreateUsernameDialog: false, - error: '' - })); - case actions.CREATE_USERNAME_FAILURE : - return state - .set('error', action.error); - case actions.CHANGE_VIEW : - return state - .set('error', '') - .set('view', action.view); + }; + case actions.CREATE_USERNAME_SUCCESS: + return { + ...state, + showCreateUsernameDialog: false, + error: '', + }; + case actions.CREATE_USERNAME_FAILURE: + return { + ...state, + error: action.error, + }; + case actions.CHANGE_VIEW: + return { + ...state, + error: action.error, + view: action.view, + }; case actions.CLEAN_STATE: return initialState; case actions.FETCH_SIGNIN_REQUEST: - return state - .set('isLoading', true); + return { + ...state, + isLoading: true, + }; case actions.CHECK_LOGIN_FAILURE: - return state - .set('checkedInitialLogin', true) - .set('loggedIn', false) - .set('user', null); + return { + ...state, + checkedInitialLogin: true, + loggedIn: false, + user: null, + }; case actions.CHECK_LOGIN_SUCCESS: - return state - .set('checkedInitialLogin', true) - .set('loggedIn', true) - .set('user', purge(action.user)); + return { + ...state, + checkedInitialLogin: true, + loggedIn: true, + user: purge(action.user), + }; case actions.FETCH_SIGNIN_SUCCESS: - return state - .set('loggedIn', true) - .set('user', purge(action.user)); + return { + ...state, + loggedIn: true, + user: purge(action.user), + }; case actions.FETCH_SIGNIN_FAILURE: - return state - .set('isLoading', false) - .set('error', action.error) - .set('user', null); + return { + ...state, + isLoading: false, + error: action.error, + user: null, + }; case actions.FETCH_SIGNUP_FACEBOOK_REQUEST: - return state - .set('fromSignUp', true); + return { + ...state, + fromSignUp: true, + }; case actions.FETCH_SIGNIN_FACEBOOK_REQUEST: - return state - .set('fromSignUp', false); + return { + ...state, + fromSignUp: false, + }; case actions.FETCH_SIGNIN_FACEBOOK_SUCCESS: - return state - .set('user', purge(action.user)) - .set('loggedIn', true); + return { + ...state, + loggedIn: true, + user: purge(action.user), + }; case actions.FETCH_SIGNIN_FACEBOOK_FAILURE: - return state - .set('error', action.error) - .set('user', null); + return { + ...state, + error: action.error, + user: null, + }; case actions.FETCH_SIGNUP_REQUEST: - return state - .set('isLoading', true); + return { + ...state, + isLoading: true, + }; case actions.FETCH_SIGNUP_FAILURE: - return state - .set('error', action.error) - .set('isLoading', false); + return { + ...state, + error: action.error, + isLoading: false, + }; case actions.FETCH_SIGNUP_SUCCESS: - return state - .set('isLoading', false) - .set('successSignUp', true); + return { + ...state, + isLoading: false, + successSignUp: true, + }; case actions.LOGOUT: - return state - .set('user', null) - .set('isLoading', false) - .set('loggedIn', false); + return { + ...state, + user: null, + isLoading: false, + loggedIn: false, + }; case actions.INVALID_FORM: - return state - .set('error', action.error); + return { + ...state, + error: action.error, + }; case actions.VALID_FORM: - return state - .set('error', ''); + return { + ...state, + error: '', + }; case actions.FETCH_FORGOT_PASSWORD_SUCCESS: - return state - .set('passwordRequestFailure', null) - .set('passwordRequestSuccess', 'If you have a registered account, a password reset link was sent to that email'); + return { + ...state, + passwordRequestFailure: null, + passwordRequestSuccess: 'If you have a registered account, a password reset link was sent to that email', + }; case actions.FETCH_FORGOT_PASSWORD_FAILURE: - return state - .set('passwordRequestFailure', 'There was an error sending your password reset email. Please try again soon!') - .set('passwordRequestSuccess', null); + return { + ...state, + passwordRequestFailure: 'There was an error sending your password reset email. Please try again soon!', + passwordRequestSuccess: null, + }; case actions.UPDATE_USERNAME: - return state - .setIn(['user', 'username'], action.username); + return { + ...state, + user: { + ...state.user, + username: action.username, + } + }; case actions.VERIFY_EMAIL_FAILURE: - return state - .set('emailVerificationFailure', true) - .set('emailVerificationLoading', false); + return { + ...state, + emailVerificationFailure: true, + emailVerificationLoading: false, + }; case actions.VERIFY_EMAIL_REQUEST: - return state.set('emailVerificationLoading', true); + return { + ...state, + emailVerificationLoading: true, + }; case actions.VERIFY_EMAIL_SUCCESS: - return state - .set('emailVerificationSuccess', true) - .set('emailVerificationLoading', false); + return { + ...state, + emailVerificationSuccess: true, + emailVerificationLoading: false, + }; case actions.SET_REQUIRE_EMAIL_VERIFICATION: - return state - .set('requireEmailConfirmation', action.required); + return { + ...state, + requireEmailConfirmation: action.required, + }; case actions.SET_REDIRECT_URI: - return state - .set('redirectUri', action.uri); + return { + ...state, + redirectUri: action.uri, + }; case 'APOLLO_SUBSCRIPTION_RESULT': if (action.operationName === 'UserBanned' && state.getIn(['user', 'id']) === action.variables.user_id) { - return state - .mergeIn(['user'], action.result.data.userBanned); + return { + ...state, + user: { + ...state.user, + ...action.result.data.userBanned, + }, + }; } if (action.operationName === 'UserSuspended' && state.getIn(['user', 'id']) === action.variables.user_id) { - return state - .mergeIn(['user'], action.result.data.userSuspended); + return { + ...state, + user: { + ...state.user, + ...action.result.data.userSuspended, + }, + }; } if (action.operationName === 'UsernameRejected' && state.getIn(['user', 'id']) === action.variables.user_id) { - return state - .mergeIn(['user'], action.result.data.usernameRejected); + return { + ...state, + user: { + ...state.user, + ...action.result.data.usernameRejected, + }, + }; } return state; default : diff --git a/client/coral-framework/reducers/index.js b/client/coral-framework/reducers/index.js index f1ac580dc..6b9b730ca 100644 --- a/client/coral-framework/reducers/index.js +++ b/client/coral-framework/reducers/index.js @@ -1,11 +1,9 @@ import auth from './auth'; -import user from './user'; import asset from './asset'; import {reducer as commentBox} from '../../talk-plugin-commentbox'; export default { auth, - user, asset, commentBox, }; diff --git a/client/coral-framework/reducers/user.js b/client/coral-framework/reducers/user.js deleted file mode 100644 index bc40cf3ae..000000000 --- a/client/coral-framework/reducers/user.js +++ /dev/null @@ -1,43 +0,0 @@ -import {Map} from 'immutable'; -import * as authActions from '../constants/auth'; -import * as actions from '../constants/user'; -import * as assetActions from '../constants/assets'; - -const initialState = Map({ - username: '', - profiles: [], - settings: {}, - myComments: [], - myAssets: [], // the assets from which myComments (above) originated -}); - -const purge = (user) => { - const {_id, created_at, updated_at, __v, roles, ...userData} = user; // eslint-disable-line - return userData; -}; - -export default function user (state = initialState, action) { - switch (action.type) { - case authActions.CHECK_LOGIN_SUCCESS: - return state.merge(Map(purge(action.user))); - case authActions.CHECK_LOGIN_FAILURE: - return initialState; - case authActions.FETCH_SIGNIN_SUCCESS: - return state.merge(Map(purge(action.user))); - case authActions.FETCH_SIGNIN_FAILURE: - return initialState; - case authActions.FETCH_SIGNIN_FACEBOOK_SUCCESS: - return state.merge(Map(purge(action.user))); - case authActions.FETCH_SIGNIN_FACEBOOK_FAILURE: - return initialState; - case actions.SAVE_BIO_SUCCESS: - return state.set('settings', action.settings); - case actions.COMMENTS_BY_USER_SUCCESS: - return state.set('myComments', action.comments); - case assetActions.MULTIPLE_ASSETS_SUCCESS: - return state.set('myAssets', action.assets); - case actions.LOGOUT_SUCCESS: - return initialState; - } - return state; -} diff --git a/client/coral-settings/containers/ProfileContainer.js b/client/coral-settings/containers/ProfileContainer.js index 0090847f7..e33c0b6cd 100644 --- a/client/coral-settings/containers/ProfileContainer.js +++ b/client/coral-settings/containers/ProfileContainer.js @@ -51,7 +51,7 @@ class ProfileContainer extends Component { }; render() { - const {auth, asset, showSignInDialog, stopIgnoringUser} = this.props; + const {auth, auth: {user}, asset, showSignInDialog, stopIgnoringUser} = this.props; const {me} = this.props.root; const loading = [1, 2, 4].indexOf(this.props.data.networkStatus) >= 0; @@ -63,14 +63,14 @@ class ProfileContainer extends Component { return ; } - const localProfile = this.props.user.profiles.find( + const localProfile = user.profiles.find( (p) => p.provider === 'local' ); const emailAddress = localProfile && localProfile.id; return (
-

{this.props.user.username}

+

{user.username}

{emailAddress ?

{emailAddress}

: null} {me.ignoredUsers && me.ignoredUsers.length @@ -138,9 +138,8 @@ const withProfileQuery = withQuery( `); const mapStateToProps = (state) => ({ - user: state.user.toJS(), - asset: state.asset.toJS(), - auth: state.auth.toJS() + asset: state.asset, + auth: state.auth }); const mapDispatchToProps = (dispatch) => diff --git a/plugin-api/beta/client/hocs/withReaction.js b/plugin-api/beta/client/hocs/withReaction.js index 7f43cc5b2..22c30d639 100644 --- a/plugin-api/beta/client/hocs/withReaction.js +++ b/plugin-api/beta/client/hocs/withReaction.js @@ -363,7 +363,7 @@ export default (reaction) => (WrappedComponent) => { ); const mapStateToProps = (state) => ({ - user: state.auth.toJS().user, + user: state.auth.user, }); const mapDispatchToProps = (dispatch) => diff --git a/plugin-api/beta/client/hocs/withTags.js b/plugin-api/beta/client/hocs/withTags.js index e9b5bdff0..b0a74f4d7 100644 --- a/plugin-api/beta/client/hocs/withTags.js +++ b/plugin-api/beta/client/hocs/withTags.js @@ -84,7 +84,7 @@ export default (tag) => (WrappedComponent) => { } const mapStateToProps = (state) => ({ - user: state.auth.toJS().user, + user: state.auth.user, }); const mapDispatchToProps = (dispatch) => diff --git a/plugins/talk-plugin-auth/client/components/ChangeUsername.js b/plugins/talk-plugin-auth/client/components/ChangeUsername.js index ed3c5ace0..c1ad081b1 100644 --- a/plugins/talk-plugin-auth/client/components/ChangeUsername.js +++ b/plugins/talk-plugin-auth/client/components/ChangeUsername.js @@ -122,7 +122,7 @@ class ChangeUsernameContainer extends React.Component { } const mapStateToProps = ({auth}) => ({ - auth: auth.toJS() + auth: auth }); const mapDispatchToProps = (dispatch) => diff --git a/plugins/talk-plugin-auth/client/components/SignInButton.js b/plugins/talk-plugin-auth/client/components/SignInButton.js index 0adb300a7..9c8a04b11 100644 --- a/plugins/talk-plugin-auth/client/components/SignInButton.js +++ b/plugins/talk-plugin-auth/client/components/SignInButton.js @@ -16,7 +16,7 @@ const SignInButton = ({loggedIn, showSignInDialog}) => ( ); const mapStateToProps = ({auth}) => ({ - loggedIn: auth.toJS().loggedIn + loggedIn: auth.loggedIn }); const mapDispatchToProps = (dispatch) => diff --git a/plugins/talk-plugin-auth/client/components/SignInContainer.js b/plugins/talk-plugin-auth/client/components/SignInContainer.js index 6950f4124..188651186 100644 --- a/plugins/talk-plugin-auth/client/components/SignInContainer.js +++ b/plugins/talk-plugin-auth/client/components/SignInContainer.js @@ -176,7 +176,7 @@ class SignInContainer extends React.Component { } const mapStateToProps = (state) => ({ - auth: state.auth.toJS() + auth: state.auth }); const mapDispatchToProps = (dispatch) => diff --git a/plugins/talk-plugin-auth/client/components/UserBox.js b/plugins/talk-plugin-auth/client/components/UserBox.js index 5b79b664a..61540d3c5 100644 --- a/plugins/talk-plugin-auth/client/components/UserBox.js +++ b/plugins/talk-plugin-auth/client/components/UserBox.js @@ -22,8 +22,8 @@ const UserBox = ({loggedIn, user, logout, onShowProfile}) => ( ); const mapStateToProps = ({auth}) => ({ - loggedIn: auth.toJS().loggedIn, - user: auth.toJS().user + loggedIn: auth.loggedIn, + user: auth.user }); const mapDispatchToProps = (dispatch) =>