import { Meteor } from 'meteor/meteor'; import { check } from 'meteor/check'; import { Rooms } from '../../../models'; Meteor.methods({ getChannelTokenpass(rid) { check(rid, String); if (!Meteor.userId()) { throw new Meteor.Error('error-invalid-user', 'Invalid user', { method: 'getChannelTokenpass' }); } const room = Rooms.findOneById(rid); if (!room) { throw new Meteor.Error('error-invalid-room', 'Invalid room', { method: 'getChannelTokenpass' }); } return room.tokenpass; }, });