diff --git a/web-ui/web-react/src/components/AdministradoresComunidad.js b/web-ui/web-react/src/components/AdministradoresComunidad.js index 4c5bab8f..84120372 100644 --- a/web-ui/web-react/src/components/AdministradoresComunidad.js +++ b/web-ui/web-react/src/components/AdministradoresComunidad.js @@ -13,6 +13,7 @@ import { faAt } from '@fortawesome/free-solid-svg-icons'; import { faIdCardAlt } from '@fortawesome/free-solid-svg-icons'; import { faEllipsis } from '@fortawesome/free-solid-svg-icons'; import { faHomeAlt } from '@fortawesome/free-solid-svg-icons'; +import { Dropdown } from 'primereact/dropdown'; const AdministradoresComunidad = () => { @@ -44,6 +45,20 @@ const AdministradoresComunidad = () => { status: '1' }; + async function getCommunites() { + let response = await fetch('http://localhost:4000/community/allCommunities', { method: 'GET' }); + let resList = await response.json(); + let list = await resList.message; + console.log(list); + + setCommunitiesList(await list); + } + + useEffect(() => { + getCommunites(); + }, []) + + async function listaAdmin() { let nombres = await fetch('http://localhost:4000/user/findAdminComunidad/', { method: 'GET' }) .then((response) => response.json()) @@ -63,25 +78,16 @@ const AdministradoresComunidad = () => { } - async function nombreComunidad(id) { - let nombres = await fetch('http://localhost:4000/community/findCommunityName/' + id, { method: 'GET' }); - let nombresRes = await nombres.json(); - return await nombresRes.message['name']; - } - - - async function setNameCommunities() { - Promise.all(listaAdmins.map(async function (administrador) { - // await listaComunidades(administrador.community_id); - administrador.community_id = await listaAdminComunidad.name; - })) - } - useEffect(() => { listaAdmin(); }, []) + const cList = communitiesList.map((item) => ({ + label: item.name, + value: item.id, + })) + const deleteAdminCommunity = () => { /* fetch('http://localhost:4000/community/deleteCommunity/' + community._id, { @@ -141,6 +147,9 @@ const AdministradoresComunidad = () => { } + const saveCommunityAdmin = () => { + + } const hideDeleteAdminCommunityDialog = () => { setDeleteAdminCommunityDialog(false); @@ -196,12 +205,12 @@ const AdministradoresComunidad = () => { const rightToolbarTemplate = () => { return ( -