Skip to content

Commit

Permalink
updateOfertas
Browse files Browse the repository at this point in the history
posee un bug cuando no hay carreras
  • Loading branch information
angelcast2002 committed Sep 27, 2023
1 parent 1b4a5b2 commit d70f6a0
Showing 1 changed file with 17 additions and 3 deletions.
20 changes: 17 additions & 3 deletions uniEmpleos/src/pages/PrincipalStudent/PrincipalStudent.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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
Expand All @@ -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}`)
Expand All @@ -71,10 +80,15 @@ const PrincipalStudent = () => {
<div className={styles.containerinfomain}>
{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 (
<InfoTab
key={postulation.id_oferta} // Asegúrate de proporcionar una clave única en elementos de lista
key={postulation.id_oferta}
title={postulation.puesto}
salary={`Q.${postulation.salario}.00`}
company={postulation.nombre_empresa}
Expand Down

0 comments on commit d70f6a0

Please sign in to comment.