UNPKG

705 BJavaScriptView Raw
1import { combineReducers } from 'redux';
2import { routerReducer as routing } from 'react-router-redux';
3import user from '../reducers/user';
4import topic from '../reducers/topic';
5import message from '../reducers/message';
6import * as types from '../types';
7
8const isFetching = (state = false, action) => {
9 switch (action.type) {
10 case types.CREATE_REQUEST:
11 return true;
12 case types.REQUEST_SUCCESS:
13 case types.REQUEST_FAILURE:
14 return false;
15 default:
16 return state;
17 }
18};
19
20// Combine reducers with routeReducer which keeps track of
21// router state
22const rootReducer = combineReducers({
23 isFetching,
24 topic,
25 user,
26 message,
27 routing
28});
29
30export default rootReducer;