Axios and Fetch API error [ OBJECT PROMISE ] #9740
Answered
by
rigor789
bobwatcherx
asked this question in
Q&A
-
Issue Descriptioncannot fetch API Reproductioni have problem for Fetch data from API this my code
My Console Successfully synced application org.nativescript.sveltenative on device 49518a86. can you have solution ? thanks Relevant log output (if applicable)No response Environmentenv: Please accept these terms
|
Beta Was this translation helpful? Give feedback.
Answered by
rigor789
Jan 16, 2022
Replies: 1 comment
-
See https://developer.mozilla.org/en-US/docs/Web/API/Response/json
fetch("https://httpbin.org/get")
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.log('err', err)) |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
rigor789
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
See https://developer.mozilla.org/en-US/docs/Web/API/Response/json
.json()
returns a Promise, so the output is correct. You need to wait for it to resolve: