fetchCategoryList.js 464 B

123456789101112131415161718
  1. import { config } from '../../config/index';
  2. /** 获取商品列表 */
  3. function mockFetchGoodCategory() {
  4. const { delay } = require('../_utils/delay');
  5. const { getCategoryList } = require('../../model/category');
  6. return delay().then(() => getCategoryList());
  7. }
  8. /** 获取商品列表 */
  9. export function getCategoryList() {
  10. if (config.useMock) {
  11. return mockFetchGoodCategory();
  12. }
  13. return new Promise((resolve) => {
  14. resolve('real api');
  15. });
  16. }