You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
pastebin/nginx/public_html/api.js

24 lines
537 B
JavaScript

// for development, to use api-stub, just import it here and export it at the end;
// it's a one-liner that switches from stub to actual api
const api = {};
// not `/api` (relative to domain root) nor `//api` (results in https:///api/...)
let prefix = "api";
let store = null;
api.setStore = function(s){
store=s;
};
api.post = function(url, body){
body = body || {};
body.session_id = store.getState().login.session_id;
return m.request({
method: 'POST',
url: prefix+url,
body
});
};
export default api;