import { json } from "@utils/ajax";
import { GET_SEARCH_RESULT } from '@store/types/medicalInfo';


export const getSearchList = (val,types) => {
    if(val.trim() == ''){
        const data = [];
        return (dispatch) =>  dispatch({
            type: GET_SEARCH_RESULT,
            searchResult: []
        })
    }
   
    return (dispatch, getState) => {
        json('/retrieval/getStaticKnowledge',{
            inputStr:val,
            inputIds:[],
            types
        })
        .then((res)=>{
            const data = res.data.data;
            dispatch({
                type: GET_SEARCH_RESULT,
                searchResult: data
            })
        })
    }
};

