import Mock from 'mockjs';
import proxy from './proxy';

Object.keys(proxy).map(method => {
  Object.keys(proxy[method]).map(URI => {
    let data = proxy[method][URI];
    Mock.mock(new RegExp(URI), method, opt => {
      console.log(`%c[mock] 链接：${opt.url} 类型：${method} 参数：${method === 'post' && JSON.stringify(opt.body) || ''}`, "color: rgb(63, 172, 203)", data);
      return data
    });
  })
})