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/client/lib/utils/call.ts

22 lines
496 B

import { Meteor } from 'meteor/meteor';
import {
ServerMethodName,
ServerMethodParameters,
ServerMethodReturn,
} from '../../contexts/ServerContext';
export const call = <M extends ServerMethodName>(
method: M,
...params: ServerMethodParameters<M>
): Promise<ServerMethodReturn<M>> =>
new Promise((resolve, reject) => {
Meteor.call(method, ...params, (error: Error, result: ServerMethodReturn<M>) => {
if (error) {
reject(error);
return;
}
resolve(result);
});
});