Skip to content

Instantly share code, notes, and snippets.

@pkellner
Created March 11, 2023 11:30
Show Gist options
  • Save pkellner/cf1154a7bfb1873253702b11c8df5fb1 to your computer and use it in GitHub Desktop.
Save pkellner/cf1154a7bfb1873253702b11c8df5fb1 to your computer and use it in GitHub Desktop.
import {DocumentNode} from "@apollo/client";
import {print} from "graphql/language/printer";
export async function getDataFromGql(gqlData: DocumentNode, variables: any = undefined) {
const data = await fetch("https://graphql.svcc.mobi/graphql", {
method: "POST",
headers: {
"Content-Type": "application/json",
},
body: JSON.stringify({
query: print(gqlData),
variables,
}),
next: {revalidate: 10},
}).then((res) => res.json());
return data;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment