Currently delving into Next.js and GraphQL, I've come across the following code snippet.
My goal is to retrieve the specified 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);
Despite my efforts, the data does not seem to be returning. Instead, this is the output I receive:
{}
[[Prototype]]: Object
What could I be doing incorrectly?