0

I'm using the fetch module on Javascript to get a JSON object from my server, but the return value is a Promise {<pending>} that has two attributes.

One is [[PromiseState]]: "fullfilled"

The other is [[PromiseResult]]: Array(1), which has my JSON response as first item in the array.

How can I retrieve my JSON object in some way? I think the best way would be "completing" the Promise but I'm using async/await with the fetch module; I already tried switching to then/catch but the result of the "then" part is still the same pending Promise.

The async/await code is the following:

(async function () {
  const result = await fetch("http://localhost:5000/check", {
    method: "GET",
  });
  
  console.log(result.json());
})();
Fsanna
  • 347
  • 1
  • 4
  • 11

0 Answers0