diff --git a/uniEmpleos/src/pages/PrincipalStudent/PrincipalStudent.jsx b/uniEmpleos/src/pages/PrincipalStudent/PrincipalStudent.jsx index 5a5c6987..b3b7ab01 100644 --- a/uniEmpleos/src/pages/PrincipalStudent/PrincipalStudent.jsx +++ b/uniEmpleos/src/pages/PrincipalStudent/PrincipalStudent.jsx @@ -17,7 +17,9 @@ const schema = Joi.object({ const PrincipalStudent = () => { const api = useApi() const apiCareers = useApi() + const apiPostulations = useApi() const [carrera, setCarrera] = useState("") + const [postulaciones, setPostulaciones] = useState([]) const form = useConfig(schema, { token: "a", @@ -37,7 +39,7 @@ const PrincipalStudent = () => { const datos = await response.json() setData(datos) } - console.log(dataa) + useEffect(() => { if (api.data && apiCareers.data) { const carreraID = api.data.usuario.carrera @@ -53,8 +55,15 @@ const PrincipalStudent = () => { configureData() api.handleRequest("GET", "/users/") apiCareers.handleRequest("GET", "/careers") + apiPostulations.handleRequest("GET", "/postulations/getFromStudent") }, []) + useEffect(() => { + if (apiPostulations.data) { + setPostulaciones(apiPostulations.data) + } + }, [apiPostulations.data]) + const saveidlocalstorage = (id) => { if (form.values.idoffert !== "a" || form.values.idoffert !== "undefined") { navigate(`/postulacion/${id}`) @@ -71,10 +80,15 @@ const PrincipalStudent = () => {
{dataa.data.postulations.map((postulation) => { const regex = new RegExp(carrera) - if (regex.test(postulation.nombre_carreras) && carrera !== "") { + if ( + regex.test(postulation.nombre_carreras) && + carrera !== "" && + postulaciones.id_oferta && + !(postulation.id_oferta in postulaciones.id_oferta) + ) { return (