import Qs from 'qs';

 function handleSearchCondition({page, size, searchCondition}) {
    let conditions = [];
    for (const key in searchCondition) {
      if (searchCondition[key].value) {
        let obj = {
          name: key,
          op: searchCondition[key].op,
          value: searchCondition[key].value,
          type: '',
          format: ''
        };
        conditions.push(obj);
      }
    }
    let params = {
      searchCondition: JSON.stringify(conditions),
      page,
      size
    };
    return Qs.stringify(params);
  }

  export default handleSearchCondition