bigbluebutton-Github/bigbluebutton-html5/imports/ui/components/nav-bar/service.js

27 lines
591 B
JavaScript
Raw Normal View History

import Auth from '/imports/ui/services/auth';
import Breakouts from '/imports/api/breakouts';
2016-11-25 03:22:04 +08:00
const getBreakouts = () => Breakouts.find().fetch();
2016-11-29 03:48:02 +08:00
const getBreakoutJoinURL = (breakout) => {
const currentUserId = Auth.userID;
2016-11-29 03:48:02 +08:00
if (breakout.users) {
2017-08-12 01:14:50 +08:00
const user = breakout.users.find(u => u.userId === currentUserId);
2016-11-29 03:48:02 +08:00
if (user) {
const urlParams = user.urlParams;
return [
window.origin,
2017-08-12 01:14:50 +08:00
`html5client/join?sessionToken=${urlParams.sessionToken}`,
2016-11-29 03:48:02 +08:00
].join('/');
}
}
2017-08-12 01:14:50 +08:00
return '';
2016-11-29 03:48:02 +08:00
};
export default {
getBreakouts,
2016-11-29 03:48:02 +08:00
getBreakoutJoinURL,
};