summaryrefslogtreecommitdiff
path: root/frontend/src/reducers.js
blob: 097f92437abbffa4f9aa93fdaacfba88f66684a8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
import { combineReducers } from 'redux-immutable'

// react-router-redux immutable reducer
import { fromJS } from 'immutable'
import { LOCATION_CHANGE } from 'react-router-redux'

const initialState = fromJS({
  locationBeforeTransitions: null
})

const routerImmutableReducer = (state = initialState, action) => {
  if (action.type === LOCATION_CHANGE) {
    return state.set('locationBeforeTransitions', action.payload)
  }

  return state
}

import gamesReducer from './redux/games'
import playersReducer from './redux/players'

export default function createReducer() {
  return combineReducers({
    games: gamesReducer,
    routing: routerImmutableReducer,
    players: playersReducer,
  })
}
bgstack15