summaryrefslogtreecommitdiff
path: root/frontend/src/redux/players.js
diff options
context:
space:
mode:
authorVictor Chabbert <chabbertvi@eisti.eu>2017-01-22 14:48:24 +0100
committerVictor Chabbert <chabbertvi@eisti.eu>2017-01-22 14:48:37 +0100
commit7b6230dc1c2613b965f4ff21836432076248dfde (patch)
tree83d8732ce9f87104faf4c6789c79d1d74dc6b575 /frontend/src/redux/players.js
parentRefactor user reducer to player reducer (diff)
downloadseven-wonders-7b6230dc1c2613b965f4ff21836432076248dfde.tar.gz
seven-wonders-7b6230dc1c2613b965f4ff21836432076248dfde.tar.bz2
seven-wonders-7b6230dc1c2613b965f4ff21836432076248dfde.zip
Normalize games data from server and display games list
Diffstat (limited to 'frontend/src/redux/players.js')
-rw-r--r--frontend/src/redux/players.js4
1 files changed, 4 insertions, 0 deletions
diff --git a/frontend/src/redux/players.js b/frontend/src/redux/players.js
index e49d4bbf..99f27d80 100644
--- a/frontend/src/redux/players.js
+++ b/frontend/src/redux/players.js
@@ -2,6 +2,7 @@ import { fromJS } from 'immutable'
export const types = {
SET_USERNAME: 'USER/SET_USERNAME',
+ SET_USERNAMES: 'USER/SET_USERNAMES',
CHOOSE_USERNAME: 'USER/CHOOSE_USERNAME'
}
@@ -12,6 +13,7 @@ export const actions = {
index,
displayName
}),
+ setPlayers: (players) => ({ type: types.SET_USERNAMES, players }),
chooseUsername: (username) => ({ type: types.CHOOSE_USERNAME, username }),
}
@@ -30,6 +32,8 @@ export default (state = initialState, action) => {
index: action.index,
})
return state.setIn(['all', user.get('username')], user).set('current', user.get('username'))
+ case types.SET_USERNAMES:
+ return state.setIn(['all'], state.get('all').mergeDeep(action.players))
default:
return state
}
bgstack15