UNPKG

instantjob-recruiter-client

Version:

a set of tools for creating an instantjob recruiter react client

49 lines (44 loc) 1.17 kB
import {routerReducer} from 'react-router-redux' import {users} from './users' import {calendar} from './calendar' import {profile} from './profile' import {messages} from './messages' import {display} from './display' import {mutes} from './mutes' import {recruiters} from './recruiters' import {missions} from './missions' import {fields} from './fields' import {demands} from './demands' import authentication from './authentication' import shifts from './shifts' const combineReducers = (reducers) => (state = {}, action) => { const new_state = {} Object.keys(reducers).map((reducer_name) => { new_state[reducer_name] = reducers[reducer_name](state[reducer_name], action) }) return new_state } const combined_reducers = combineReducers({ authentication, users, calendar, profile, messages, display, mutes, recruiters, missions, fields, demands, shifts, routing: routerReducer, }) export default function reducer(state, action) { if (action.type == 'logout') { state = undefined } if (action.type == 'combined_actions') { return action.actions.reduce(reducer, state) } return combined_reducers(state, action) }