import { json } from "@utils/ajax";
import { GET_SCALE_SEARCH_RESULT } from '@store/types/scaleSearch';


export const getSearchList = (val) => {
    if(val.trim() == ''){
        const data = [];
        return (dispatch) =>  dispatch({
            type: GET_SCALE_SEARCH_RESULT,
            data: []
        })
    }
   
    return (dispatch) => {
        json('/scale/index',{
            name:val,
            filterName:[]
        })
        .then((res)=>{
            const data = res.data.data;
            dispatch({
                type: GET_SCALE_SEARCH_RESULT,
                data: data
            })
        })
    }
};

