Fixed type

This commit is contained in:
Luis Alvarez
2020-10-21 15:21:31 -05:00
parent 1569d62902
commit 316801627b
3 changed files with 49 additions and 36 deletions

View File

@@ -20,6 +20,8 @@ export default async function fetchGraphqlApi<Q, V = any>(
}),
})
// console.log('HEADERS', getRawHeaders(res))
const json = await res.json()
if (json.errors) {
console.error(json.errors)
@@ -27,3 +29,13 @@ export default async function fetchGraphqlApi<Q, V = any>(
}
return json.data
}
function getRawHeaders(res: Response) {
const headers: { [key: string]: string } = {}
res.headers.forEach((value, key) => {
headers[key] = value
})
return headers
}