api.js 729 B

12345678910111213141516171819202122232425
  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://ssr.alpha.elenet.me/element-theme-server/',
  7. production: 'https://ssr.ele.me/element-theme-server/',
  8. productionEle: 'https://ssr.elenet.me/element-theme-server/'
  9. };
  10. const host = hostList[process.env.FAAS_ENV] || hostList.production;
  11. export const getVars = () => {
  12. return get(`${host}getVariable?version=${version}`);
  13. };
  14. export const getTestEle = () => {
  15. return get(`${hostList.productionEle}getVariable?version=${version}`);
  16. };
  17. export const updateVars = (data, cb) => {
  18. return post(`${host}updateVariable?version=${version}`, data, cb);
  19. };