fetchComments.js 486 B

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