From c269b6dbd2c994734ab84d6385613ece50fcb11c Mon Sep 17 00:00:00 2001 From: Victor Chabbert Date: Sun, 22 Jan 2017 15:15:56 +0100 Subject: Add forgotten immutable data and remove unhandled action case --- frontend/src/redux/games.js | 2 -- frontend/src/sagas/usernameChoice.js | 5 +++-- 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')) } -- cgit