Skip to content

Commit

Permalink
fix: properly use axios API
Browse files Browse the repository at this point in the history
  • Loading branch information
lbenie committed Mar 30, 2022
1 parent 3894ddc commit c04880c
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions lib/use-contentful.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,16 @@ export const useContentful = <T>(
const URI = `https://graphql.contentful.com/content/v1/spaces/${spaceId}`

axios
.post<ContentfulResponse<T>>(URI, {
headers: {
Authorization: `Bearer ${token}`,
'Content-Type': 'application/json',
.post<ContentfulResponse<T>>(
URI,
{ query },
{
headers: {
Authorization: `Bearer ${token}`,
'Content-Type': 'application/json',
},
},
body: JSON.stringify({ query }),
})
)
.then(({ data }) => data)
.then(({ data: response, errors: contenfulErrors }) => {
isLoading.value = false
Expand Down

0 comments on commit c04880c

Please sign in to comment.