Created
March 11, 2023 11:30
-
-
Save pkellner/cf1154a7bfb1873253702b11c8df5fb1 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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