bigbluebutton-Github/bigbluebutton-html5/imports/ui/components/waiting-users/guest-policy/container.jsx
2024-01-10 09:07:38 -03:00

31 lines
907 B
JavaScript

import React from 'react';
import { withTracker } from 'meteor/react-meteor-data';
import { useMutation } from '@apollo/client';
import GuestPolicyComponent from './component';
import Service from '../service';
import useCurrentUser from '/imports/ui/core/hooks/useCurrentUser';
import { SET_POLICY } from '../mutations';
const GuestPolicyContainer = (props) => {
const { data: currentUserData } = useCurrentUser((user) => ({
isModerator: user.isModerator,
}));
const amIModerator = currentUserData?.isModerator;
const [setPolicy] = useMutation(SET_POLICY);
const changeGuestPolicy = (guestPolicy) => {
setPolicy({
variables: {
guestPolicy,
},
});
};
return amIModerator && <GuestPolicyComponent changeGuestPolicy={changeGuestPolicy} {...props} />;
};
export default withTracker(() => ({
guestPolicy: Service.getGuestPolicy(),
}))(GuestPolicyContainer);