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?
The endpoint as I visit it now is an interactive igraphql endpoint. Making the same request and looking at the network request, the endpoint you should be using is
https://data.objkt.com/v1/graphql
I can't speak to what authentication you may require.