diff options
Diffstat (limited to 'frontend/src/redux/currentGame.js')
-rw-r--r-- | frontend/src/redux/currentGame.js | 19 |
1 files changed, 7 insertions, 12 deletions
diff --git a/frontend/src/redux/currentGame.js b/frontend/src/redux/currentGame.js index e5659195..e315a1e8 100644 --- a/frontend/src/redux/currentGame.js +++ b/frontend/src/redux/currentGame.js @@ -1,27 +1,22 @@ // @flow -import { List } from 'immutable'; import { combineReducers } from 'redux'; import type { ApiPlayerTurnInfo, ApiTable } from '../api/model'; -import { CurrentGameState } from '../models/currentGame'; +import type { GlobalState } from '../reducers'; import type { Action } from './actions/all'; import { types } from './actions/game'; +export type CurrentGameState = { + turnInfo: ApiPlayerTurnInfo | null; + table: ApiTable | null; +} + export function createCurrentGameReducer() { return combineReducers({ - readyUsernames: readyUsernamesReducer, turnInfo: turnInfoReducer, table: tableUpdatesReducer, }); } -const readyUsernamesReducer = (state: List<string> = new List(), action: Action) => { - if (action.type === types.PLAYER_READY_RECEIVED) { - return state.push(action.username); - } else { - return state; - } -}; - const turnInfoReducer = (state: ApiPlayerTurnInfo | null = null, action: Action) => { switch (action.type) { case types.TURN_INFO_RECEIVED: @@ -44,4 +39,4 @@ const tableUpdatesReducer = (state: ApiTable | null = null, action: Action) => { } }; -export const getCurrentTurnInfo = (state: CurrentGameState): ApiPlayerTurnInfo => state.turnInfo; +export const getCurrentTurnInfo = (state: GlobalState): ApiPlayerTurnInfo => state.currentGame.turnInfo; |