api.js 493 B

12345678910111213141516171819
  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. production: 'https://element-api.ele.me/element/theme/'
  7. };
  8. const host = hostList[process.env.FAAS_ENV] || hostList.production;
  9. export const getVars = () => {
  10. return get(`${host}getVariable?version=${version}`);
  11. };
  12. export const updateVars = (data, cb) => {
  13. return post(`${host}updateVariable?version=${version}`, data, cb);
  14. };