Skip to content

Commit

Permalink
async/await style
Browse files Browse the repository at this point in the history
  • Loading branch information
mxstbr committed Jun 30, 2020
1 parent b6006c2 commit 8e305c3
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions packages/gatsby-recipes/src/providers/gatsby/page.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ module.exports.config = {}
const queryDevelopAPI = async ({ root }, query) => {
const { port } = await getService(root, `developproxy`)

return fetch(`http://localhost:${port}/___graphql`, {
const res = await fetch(`http://localhost:${port}/___graphql`, {
method: `POST`,
body: JSON.stringify({
query,
Expand All @@ -43,7 +43,10 @@ const queryDevelopAPI = async ({ root }, query) => {
Accept: `application/json`,
"Content-Type": `application/json`,
},
}).then(res => res.json())
})
const body = await res.json()

return body
}

module.exports.all = async ({ root }) => {
Expand Down

0 comments on commit 8e305c3

Please sign in to comment.