summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVictor Chabbert <chabbertvi@eisti.eu>2017-01-22 15:15:56 +0100
committerVictor Chabbert <chabbertvi@eisti.eu>2017-01-22 15:15:56 +0100
commitc269b6dbd2c994734ab84d6385613ece50fcb11c (patch)
tree5e3fe13b26c4b055e86b88f3b56d30fbf26a26c0
parentNormalize games data from server and display games list (diff)
downloadseven-wonders-c269b6dbd2c994734ab84d6385613ece50fcb11c.tar.gz
seven-wonders-c269b6dbd2c994734ab84d6385613ece50fcb11c.tar.bz2
seven-wonders-c269b6dbd2c994734ab84d6385613ece50fcb11c.zip
Add forgotten immutable data and remove unhandled action case
-rw-r--r--frontend/src/redux/games.js2
-rw-r--r--frontend/src/sagas/usernameChoice.js5
2 files changed, 3 insertions, 4 deletions
diff --git a/frontend/src/redux/games.js b/frontend/src/redux/games.js
index 4d393317..b5fd910e 100644
--- a/frontend/src/redux/games.js
+++ b/frontend/src/redux/games.js
@@ -19,8 +19,6 @@ const initialState = Map({})
export default (state = initialState, action) => {
switch (action.type) {
- case types.NEW_GAME:
- return state.set(action.game.get('id'), action.game)
case types.CREATE_OR_UPDATE_GAMES:
return state.mergeDeep(action.games)
default:
diff --git a/frontend/src/sagas/usernameChoice.js b/frontend/src/sagas/usernameChoice.js
index e9812c72..60b7d327 100644
--- a/frontend/src/sagas/usernameChoice.js
+++ b/frontend/src/sagas/usernameChoice.js
@@ -1,13 +1,14 @@
import { call, take, put } from 'redux-saga/effects'
import { eventChannel } from 'redux-saga'
import { push } from 'react-router-redux'
+import { fromJS } from 'immutable'
import { actions, types } from '../redux/players'
function usernameValidationChannel(socket) {
return eventChannel(emitter => {
const receiveUsernameHandler = socket.subscribe('/user/queue/nameChoice', event => {
- emitter(JSON.parse(event.body))
+ emitter(fromJS(JSON.parse(event.body)))
})
const unsubscribe = () => receiveUsernameHandler.unsubscribe()
@@ -20,7 +21,7 @@ function *usernameValidation({ socket }) {
const usernameChannel = usernameValidationChannel(socket)
const user = yield take(usernameChannel)
- yield put(actions.setUsername(user.username, user.displayName, user.index))
+ yield put(actions.setUsername(user.get('username'), user.get('displayName'), user.get('index')))
usernameChannel.close()
yield put(push('/games'))
}
bgstack15