All files / reducers NewsReducer.js

100% Statements 6/6
100% Branches 5/5
100% Functions 1/1
100% Lines 6/6
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20    1x           4x   1x   1x   1x   1x      
import { request, invalidate, receiveNested as receive } from '../boilerplate';
import { REQUEST_NEWS, RECEIVE_NEWS, INVALIDATE_NEWS } from '../actionTypes';
const initState = {
  isFetching: false,
  didInvalidate: false,
  data: {},
};
export default function newsReducer(state = initState, action) {
  switch (action.type) {
    case REQUEST_NEWS:
      return request(state, action);
    case RECEIVE_NEWS:
      return receive(state, action);
    case INVALIDATE_NEWS:
      return invalidate(state, action);
    default:
      return state;
  }
}