import { FETCHING_LISTINGS, GET_ALL_LISTINGS_SUCCESS, CHANGE_SEARCH_FIELD } from '../constants';


export const initialState = {
  allListings: [],
  isFetching: false,
  searchField: '',
};

export const listings = (state = initialState, action) => {
  switch (action.type) {
    case GET_ALL_LISTINGS_SUCCESS:
      return ({ ...state, allListings: action.payload, isFetching: false });
    case FETCHING_LISTINGS:
      return ({ ...state, isFetching: true});
    case CHANGE_SEARCH_FIELD:
      return ({ ...state, searchField: action.value });
    default:
      return state;
  }
};

@@ -181,16 +181,138 @@
 ld: '',%0A
+  filters: %7B%0A    categories: %7B%0A      'Home Improvement': false,%0A      Technology: false,%0A    %7D,%0A    distance: false,%0A  %7D,%0A
 %7D;%0A%0Aexpo

add filter object to state