element/examples/components/theme/loader/api.js

25 lines
637 B
JavaScript
Raw Normal View History

import Element from 'main/index.js';
import { post, get } from './ajax';
const { version } = Element;
const hostList = {
local: 'http://localhost:3008/',
2019-07-18 05:32:30 +00:00
alpha: 'https://element-api.ar.elenet.me/element/theme/',
production: 'https://element-api.ele.me/element/theme/'
};
const host = hostList[process.env.FAAS_ENV] || hostList.production;
export const getVars = () => {
return get(`${host}getVariable?version=${version}`);
};
2019-05-30 11:49:23 +00:00
export const getTestEle = () => {
2019-07-18 05:32:30 +00:00
return get(`${hostList.alpha}getVariable`);
2019-05-30 11:49:23 +00:00
};
export const updateVars = (data, cb) => {
return post(`${host}updateVariable?version=${version}`, data, cb);
};