The communications platform that puts data protection first.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
Rocket.Chat/app/ui-utils/client/lib/callMethod.js

19 lines
553 B

import { Meteor } from 'meteor/meteor';
import { handleError } from '../../../utils';
/**
* Wraps a Meteor method into a Promise.
* This is particularly useful for creating information dialogs after execution of a Meteor method
* @param {The Meteor method to be calls} method
* @param {the method's parameters} params
*/
export const call = (method, ...params) => new Promise((resolve, reject) => {
Meteor.call(method, ...params, (err, result) => {
if (err) {
handleError(err);
return reject(err);
}
return resolve(result);
});
});