text: import moment from "moment";
  
  const filtersReducerDefault = {
    text: "",
    sortBy: "date",
    startDate: moment().startOf("month"),
    endDate: moment().endOf("month"),
  };
  
  const filtersReducer = (state = filtersReducerDefault, action) => {
    switch (action.type) {
      case "SET_TEXT_FILTER":
        return { ...state, text: action.text };
      case "SORT_BY_AMOUNT":
        return { ...state, sortBy: "amount" };
      case "SORT_BY_DATE":
        return { ...state, sortBy: "date" };
      case "SET_START_DATE":
        return { ...state, startDate: action.momentObj };
      case "SET_END_DATE":
        return { ...state, endDate: action.momentObj };
      default:
        return state;
    }
  };
  
  export default filtersReducer;
  