diff options
Diffstat (limited to 'sw-ui/src/reducers.ts')
-rw-r--r-- | sw-ui/src/reducers.ts | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/sw-ui/src/reducers.ts b/sw-ui/src/reducers.ts new file mode 100644 index 00000000..f885f642 --- /dev/null +++ b/sw-ui/src/reducers.ts @@ -0,0 +1,31 @@ +import { routerReducer } from 'react-router-redux'; +import { combineReducers } from 'redux'; +import { ApiPlayer } from './api/model'; +import { CurrentGameState, EMPTY_CURRENT_GAME } from './redux/currentGame'; +import { createCurrentGameReducer } from './redux/currentGame'; +import { EMPTY_GAMES, GamesState } from './redux/games'; +import { createGamesReducer } from './redux/games'; +import { currentUserReducer } from './redux/user'; + +export type GlobalState = { + currentGame: CurrentGameState; + currentUser: ApiPlayer | null; + games: GamesState; + routing: any; +} + +export const INITIAL_STATE: GlobalState = { + currentGame: EMPTY_CURRENT_GAME, + currentUser: null, + games: EMPTY_GAMES, + routing: null, +}; + +export function createReducer() { + return combineReducers({ + currentGame: createCurrentGameReducer(), + currentUser: currentUserReducer, + games: createGamesReducer(), + routing: routerReducer, + }); +} |