import { combineReducers } from 'redux';

const createFilteredListReducerFor = (filter) => {
  const ids = (state = [], action) => {
    if(action.filter !== filter) { return state; }

    switch (action.type) {
     case 'FETCH_TODOS_SUCCESS':
       return action.response.map(todo => todo.id);
     default:
       return state;
    }
  };

  const isFetching = (state = false, action) => {
    if(action.filter !== filter) { return state; }

    switch (action.type) {
      case 'FETCH_TODOS_SUCCESS':
      case 'FETCH_TODOS_FAILURE':
        return false;
      case 'FETCH_TODOS_REQUEST':
        return true;
      default:
        return state;
    }
  };

  return combineReducers({ ids, isFetching });
};

export default createFilteredListReducerFor;

export const getIds = (state) => state.ids;
export const getIsFetching = (state) => state.isFetching;

@@ -660,16 +660,349 @@
 %7D%0A  %7D;%0A%0A
+  const errorMessage = (state = null, action) =%3E %7B%0A    if(action.filter !== filter) %7B return state; %7D%0A%0A    switch (action.type) %7B%0A      case 'FETCH_TODOS_FAILURE':%0A        return action.message;%0A      case 'FETCH_TODOS_SUCCESS':%0A      case 'FETCH_TODOS_REQUEST':%0A        return null;%0A      default:%0A        return state;%0A    %7D%0A  %7D;%0A%0A
   return
@@ -1035,16 +1035,30 @@
 Fetching
+, errorMessage
  %7D);%0A%7D;%0A
@@ -1206,8 +1206,70 @@
 tching;%0A
+export const getErrorMessage = (state) =%3E state.errorMessage;%0A

add errorMessage reducer to createFilteredListReducerFor