Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

298
Views
Axios múltiplos de entonces

Entonces tengo un problema, quiero que este Axios me devuelva el segundo entonces, y no funciona, y no puedo entender por qué. Entonces, este segundo me devuelve indefinido, pero quería obtener una identificación de eso o cualquier dato, ¿alguna sugerencia? Revisé algunas otras publicaciones, parecían tener la misma escritura, pero para mí simplemente no funciona, ayuda por favor :)

Si quieres comprobar Axios, al final escribe ?q=Grimm (por ejemplo). Así que la página completa es: https://api.tvmaze.com/singlesearch/shows?q=Grimm

 .get('https://api.tvmaze.com/singlesearch/shows', { params: { q: id, }, }) .then((res) => setOneShow([res.data])) .then((res) => console.log(res));
over 4 years ago · Santiago Trujillo
2 answers
Answer question

0

En una .then() chain , el segundo bloque then obtiene datos devueltos desde el primer bloque then .

En su caso, para obtener los mismos datos en el segundo bloque then modifique su código como:

 axios.get("https://api.tvmaze.com/singlesearch/shows", { params: { q: id } }) .then((res) => { console.log("1", res); return res; }) .then((res) => console.log("2", res)); }
over 4 years ago · Santiago Trujillo Report

0

Revisa estas lecciones: Funciones de flecha , Promesas . Está llamando y devolviendo setOneShow() en su primer método .then() , no res . Cómo debería verse:

 axios.get('https://api.tvmaze.com/singlesearch/shows', { params: { q: id, }, }) .then((res) => { setOneShow([res.data]); return res; }) .then((res) => { console.log(res); });
over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!