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

175
Views
¿Usar un valor de graphql en una variable?

Creé lo siguiente (usando supertest) y lo coloqué en una función (importaciones eliminadas, etc. por brevedad)

 module.export = { addThing: async function(title, done) { const someGraphQL = `mutation {.....}` let the_id = "" request .post("/graphql") .send({ query: someGraphQL }) .set("Accept", "application/json") .expect(200) .end((err, res) => { if (err) return done(err); the_id = Prmise.resolve(res.body.data.id); console.log(res.body.data.id) }) console.log(the_id) return the_id } }

Cuando llamo a esto, puedo ver el archivo console.log con "res.body.data.id", pero no el que está en la variable.

Pensé que esto podría haber sido un comportamiento de tipo asíncrono, pero como siempre veo el registro de la consola para res.body.data.id (pero no para la variable (sin importar dónde coloque la variable), estoy confundido?

about 4 years ago · Juan Pablo Isaza
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!