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

const fetchProducts = () => {
  return axios
    .get(`/api/products/list`)
    .then(function (response) {
      let { data } = response;
      let { products } = data;

      return products;
    })
    .catch(function (error) {
      // handle error
      console.log(error);
    });
};

export default fetchProducts;
