diff --git a/src/app/services/breathecode.js b/src/app/services/breathecode.js
index ee63b146..2a4d3597 100644
--- a/src/app/services/breathecode.js
+++ b/src/app/services/breathecode.js
@@ -343,6 +343,13 @@ class BreatheCodeClient {
payload
);
},
+ addGithubUser: (payload) => {
+ return axios.bcPost(
+ "Invite",
+ `${this.host}/auth/academy/github/user`,
+ payload
+ );
+ },
resendInvite: (user) =>
axios.bcPut(
"Invite",
diff --git a/src/app/views/admin/github-form/OrganizationUsers.jsx b/src/app/views/admin/github-form/OrganizationUsers.jsx
index 20e860ff..2c609c32 100644
--- a/src/app/views/admin/github-form/OrganizationUsers.jsx
+++ b/src/app/views/admin/github-form/OrganizationUsers.jsx
@@ -16,6 +16,7 @@ import bc from '../../../services/breathecode';
import dayjs from 'dayjs';
import config from '../../../../config.js';
import { faLastfmSquare } from "@fortawesome/free-brands-svg-icons";
+import { PickCohortUserModal } from "./PickCohortUserModal";
const relativeTime = require('dayjs/plugin/relativeTime');
@@ -56,7 +57,7 @@ const getStatus = (u) => {
const OrganizationUsers = ({ organization }) => {
const [items, setItems] = useState([]);
-
+ const [ userToAdd, setUserToAdd] = useState(false);
const columns = [
{
@@ -68,7 +69,7 @@ const OrganizationUsers = ({ organization }) => {
return (
{item.user !== null &&
{item.user.first_name + " " + item.user.last_name}
}
- {item.username}
+ {item.username ? {item.username} : No username found}
);
},
@@ -105,8 +106,26 @@ const OrganizationUsers = ({ organization }) => {
return data;
}
+ const addToOrganization = async (cu) => {
+ if(!cu) return false;
+
+ const result = await bc.auth().addGithubUser({ cohort: cu.cohort.id, user: cu.user.id });
+ setUserToAdd(false);
+ loadData();
+ }
+
return (
+ { userToAdd == true && addToOrganization(_cu)}
+ />}
+
+
+
{
+
+ const [cohort, setCohort] = useState(defaultCohort)
+ const [cohortUser, setCohortUser] = useState(defaultCohortUser)
+ const [ error, setError ] = useState(null)
+
+ return (
+ <>
+
+ >
+ )
+}
+
+PickCohortUserModal.defaultProps = defaultProps;
\ No newline at end of file
diff --git a/src/app/views/admin/github.jsx b/src/app/views/admin/github.jsx
index 011e7e91..a4725470 100644
--- a/src/app/views/admin/github.jsx
+++ b/src/app/views/admin/github.jsx
@@ -1,9 +1,10 @@
import React, { useEffect, useState } from "react";
-import { Grid } from "@material-ui/core";
+import { Grid, Button } from "@material-ui/core";
import { Alert, AlertTitle } from "@material-ui/lab";
import { useSelector } from 'react-redux';
import { Breadcrumb } from "../../../matx";
import bc from "../../services/breathecode";
+import { Link } from 'react-router-dom';
import OrganizationUsers from "./github-form/OrganizationUsers";
import GithubOrganization from "./github-form/GithubOrganization";
import { MatxLoading } from 'matx';
@@ -87,7 +88,7 @@ const GithubSettings = () => {
return (