diff options
Diffstat (limited to 'frontend/src/redux/user.js')
-rw-r--r-- | frontend/src/redux/user.js | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/frontend/src/redux/user.js b/frontend/src/redux/user.js new file mode 100644 index 00000000..0279b49c --- /dev/null +++ b/frontend/src/redux/user.js @@ -0,0 +1,29 @@ +import { fromJS } from 'immutable' + +export const types = { + SET_USERNAME: 'USER/SET_USERNAME', +} + +export const setUsername = (userName, displayName, index) => ({ + type: types.SET_USERNAME, + userName, + index, + displayName +}) + +const initialState = fromJS({ + username: '', + displayName: '', + id: null +}) + +export default (state = initialState, action) => { + switch (action.type) { + case types.SET_USERNAME: + return state.set('username', action.userName) + .set('displayName', action.displayName) + .set('id', action.index) + default: + return state + } +} |