import { SET_SEARCH_VALUE, GET_SEARCH_RESULT ,CLEAR_INFO_SEARCH_LIST,SET_FILTER_LIST} from '../types/medicalInfo';
import { setSearchValue, getSearchResult } from '../actions/medicalInfo'; 

const initState = {
    searchValue: '',
    searchResult: [],
    filterList:[],      //搜索分类
}

export default function (state=initState, action) {
  const res = Object.assign({},state);
    switch(action.type) {
        case SET_SEARCH_VALUE: 
            return setSearchValue(state, action);
        case GET_SEARCH_RESULT: 
            return getSearchResult(state, action);
        case CLEAR_INFO_SEARCH_LIST:
            res.searchResult=[];
            return res;
      case SET_FILTER_LIST:
            res.filterList = action.list;
            return res;
        default: 
            return state;
    }
}