import { config } from '../../config/index';

/** 获取商品列表 */
function mockFetchGood(ID = 0) {

  const { delay } = require('../_utils/delay');
  const { genGood } = require('../../model/good');

  return delay().then(() => {
    const res = genGood(ID);
    console.log("mock fetch goood return res", res);
    return res;
  });
}

/** 获取商品列表 */
export function fetchGood(ID = 0) {
  if (config.useMock) {
    return mockFetchGood(ID);
  }
  return new Promise((resolve) => {
    resolve('real api');
  });
}
