bigbluebutton-Github/bigbluebutton-html5/imports/ui/services/api/index.js

21 lines
657 B
JavaScript
Raw Normal View History

import { getCredentials } from '/imports/ui/services/auth';
2016-07-06 00:47:40 +08:00
/* TODO: Will be pretty sweet if we return a promise from the callServer function */
function callServer(name) {
2016-05-14 00:31:06 +08:00
if (!name || !(typeof (name) === 'string' || name instanceof String) || name.length === 0 ||
!name.trim() || /^\s*$/.test(name)) {
console.error(`serverCall: invalid function name '${name}'`);
return false;
}
const credentials = getCredentials();
// slice off the first element. That is the function name but we already have that.
2016-05-19 03:26:51 +08:00
const args = Array.prototype.slice.call(arguments, 1);
Meteor.call(name, credentials, ...args);
};
export {
callServer,
};