'Graphql fetch api not returning data
I am learning Next.js and GraphQL. I have the following code.
I am trying to return the following query
export async function getStaticProps() {
const client = new ApolloClient({
uri: "https://data.objkt.com/graphiql/",
cache: new InMemoryCache(),
})
const{data} = await client.query({
query: gql`
query{
fa2_by_pk(contract: "KT1LHHLso8zQWQWg1HUukajdxxbkGfNoHjh6") {
floor_price
}
}
`
});
return {
props: {
c: data.fa2_by_pk.floor_price,
}
}
}
export default function Home(c) {
console.log(c);
However I do not seem to be getting the data back. This is what I see
{}
[[Prototype]]: Object
What am I doing wrong?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
