import axios from 'axios';
import { API_PREF } from './common';

const fetchListByCategoryUnsold = ({ cid }) => {
  return axios
    .get(`/api/products/listByCategoryUnsold?cid=${cid}`)
    .then(res => {
      let {
        data: { products },
      } = res;
      return products;
    })
    .catch(err => console.error(err));
};

export default fetchListByCategoryUnsold;
