api.js 807 B

12345678910111213141516171819202122232425262728
  1. import Element from 'main/index.js';
  2. import { post, get } from './ajax';
  3. const { version } = Element;
  4. const hostList = {
  5. local: 'http://localhost:3008/',
  6. alpha: 'https://element-api.ar.elenet.me/element/theme/',
  7. production: 'https://element-api.ele.me/element/theme/'
  8. };
  9. const host = hostList[process.env.FAAS_ENV] || hostList.production;
  10. export const getVars = () => {
  11. return get(`${host}getVariable?version=${version}`);
  12. };
  13. export const getTestEle = () => {
  14. return get(`${hostList.alpha}getVariable`);
  15. };
  16. export const getTestAli = () => {
  17. return get(`https://private-alipayobjects.alipay.com/alipay-rmsdeploy-image/rmsportal/VmvVUItLdPNqKlNGuRHi.png?t=${Date.now()}`);
  18. };
  19. export const updateVars = (data, cb) => {
  20. return post(`${host}updateVariable?version=${version}`, data, cb);
  21. };