+ {member?.user.name} |
+
+ handleSetNewPermission(e.target.value)}
+ />
+ |
+
+ );
+};
+
+ChangePermissionContainer.propTypes = {
+ perm: PropTypes.number,
+ setMessage: PropTypes.func,
+ currGroup: PropTypes.number,
+ member: PropTypes.node,
+ handleFetchGroupMembers: PropTypes.func,
+ setShowMessage: PropTypes.func,
+};
+
+const GroupCreate = () => {
+ const initialMessage = {
+ type: "success",
+ text: "",
+ };
+
+ const [currGroup, setCurrentGroup] = useState(null);
+ const [groupMembers, setGroupMembers] = useState([]);
+ const [groups, setGroups] = useState([]);
+
+ const [showMessage, setShowMessage] = useState(false);
+ const [message, setMessage] = useState(initialMessage);
+
+ useEffect(async () => {
+ try {
+ const res = await fetchAllGroups();
+ const resGrpMembers = await fetchAllGroupMembers(res[0].id);
+ setCurrentGroup(res[0].id);
+ setGroups(res);
+ setGroupMembers(resGrpMembers);
+ } catch (e) {
+ setMessage({
+ type: "danger",
+ text: e.message,
+ });
+ }
+ }, []);
+
+ const handleFetchGroupMembers = async (groupId) => {
+ try {
+ const res = await fetchAllGroupMembers(groupId);
+ setGroupMembers(res);
+ } catch (error) {
+ setMessage({
+ type: "danger",
+ text: error.message,
+ });
+ }
+ };
+
+ const handleGroupChange = async (e) => {
+ setCurrentGroup(e.target.value);
+ await handleFetchGroupMembers(e.target.value);
+ };
+
+ return (
+ <>
+