Skip to content

Commit 6ab1e1c

Browse files
authored
Fix chapter 2 forgotten await
Body.json() return a Promise. WIthout the await there, it would log a pending Promise. https://developer.mozilla.org/en-US/docs/Web/API/Body/json
1 parent 76c6736 commit 6ab1e1c

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

chapters/ch02.asciidoc

+1-1
Original file line numberDiff line numberDiff line change
@@ -464,7 +464,7 @@ If we want to take things a bit further, we can chain onto the response object t
464464
[source,javascript]
465465
----
466466
const res = await fetch('/api/users/john')
467-
const data = res.json()
467+
const data = await res.json()
468468
console.log(data.name)
469469
// <- 'John Doe'
470470
----

0 commit comments

Comments
 (0)