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

240
Views
How to access the Promise object?

I have this code that returns a Promise as i see in the browser

    const data2 = fetchCurrentWeatherID({
    params: {id: data.id - 3204, appid: 'ebc8de08ce3579cf444b51c12772a8bc'},
  })

  console.log(data2)

The result in the browser is:

↓Promise {<pending>}
 →[[Prototype]]: Promise
  [[PromiseState]]: "rejected"
 →[[PromiseResult]]: Error: Request failed with status code 404 at createError (http://localhost:3000/vendors~main.8c0082efa14d3f9d53ec.hot-update.js:767:15) at settle (http://localhost:3000/vendors~main.8c0082efa14d3f9d53ec.hot-update.

in case the Promise is resolved the result is:

↓Promise {<pending>}
 →[[Prototype]]: Promise
  [[PromiseState]]: "fulfilled"
 →[[PromiseResult]]: Object

I would like to access the PromiseState and the PromiseResult! I have made this API call with React.js

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

const data2 = fetchCurrentWeatherID({
  params: {id: data.id - 3204, appid: 'ebc8de08ce3579cf444b51c12772a8bc'},
})

console.log(data2);
data2
  .then(result => console.log(result))  // the resolved data result
  .catch(err => console.log('something went wrong, error was', err)); // any errors
about 4 years ago · Juan Pablo Isaza 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!