diff options
Diffstat (limited to 'frontend/src/redux/user.js')
-rw-r--r-- | frontend/src/redux/user.js | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/frontend/src/redux/user.js b/frontend/src/redux/user.js index 0279b49c..5926ed59 100644 --- a/frontend/src/redux/user.js +++ b/frontend/src/redux/user.js @@ -2,14 +2,19 @@ import { fromJS } from 'immutable' export const types = { SET_USERNAME: 'USER/SET_USERNAME', + CHOOSE_USERNAME: 'USER/CHOOSE_USERNAME' +} + +export const actions = { + setUsername: (username, displayName, index) => ({ + type: types.SET_USERNAME, + username, + index, + displayName + }), + chooseUsername: (username) => ({ type: types.CHOOSE_USERNAME, username }), } -export const setUsername = (userName, displayName, index) => ({ - type: types.SET_USERNAME, - userName, - index, - displayName -}) const initialState = fromJS({ username: '', @@ -20,7 +25,7 @@ const initialState = fromJS({ export default (state = initialState, action) => { switch (action.type) { case types.SET_USERNAME: - return state.set('username', action.userName) + return state.set('username', action.username) .set('displayName', action.displayName) .set('id', action.index) default: |