import { actionPromise } from ".";
import  gql  from '../api';


const actionSearchGood = (name) =>
  
    actionPromise('searchGood', gql(`
      query gf($query: String){
          GoodFind(query: $query){
              _id, name, description, price, images{
                  _id, url
              }
          }
      }`, {
        query: JSON.stringify([
                  {
                      $or: [{name}, {description: name}]
                  },
                  {
                      sort: [{name: 1}]
                  }
                  ])
          }
      )
    )
  

export default actionSearchGood;
