api.js 557 B

1234567891011121314151617181920
  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.elenet.me/element-theme-server/'
  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 updateVars = (data, cb) => {
  14. return post(`${host}updateVariable?version=${version}`, data, cb);
  15. };