summaryrefslogtreecommitdiff
path: root/frontend/src/redux
diff options
context:
space:
mode:
authorJoffrey BION <joffrey.bion@gmail.com>2017-01-22 11:42:46 +0100
committerJoffrey BION <joffrey.bion@gmail.com>2017-01-22 11:42:46 +0100
commit87d82a83915044f6e988455d80b46f9f9f19a797 (patch)
treec584f21bdf771a86e3cc49bda78c240297864d71 /frontend/src/redux
parentAdd validation constraints on PlayerMove (diff)
parentBetter implementation of username choice (diff)
downloadseven-wonders-87d82a83915044f6e988455d80b46f9f9f19a797.tar.gz
seven-wonders-87d82a83915044f6e988455d80b46f9f9f19a797.tar.bz2
seven-wonders-87d82a83915044f6e988455d80b46f9f9f19a797.zip
Merge remote-tracking branch 'remotes/origin/feature/front'
Diffstat (limited to 'frontend/src/redux')
-rw-r--r--frontend/src/redux/user.js19
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:
bgstack15