Created by danielkelbelle11 291 days ago Viewed 61 times 0 Points
No comments yet
import { Resource } from "https://deno.land/x/windmill@v1.70.1/mod.ts"
export async function main(
auth: Resource<'faunadb'>,
query: string,
variables?: Record<string, any>,
operationName?: string
) {
const region = ['us', 'eu'].includes(auth.region) ? auth.region : '';
const response = await fetch(`https://graphql.${region}.fauna.com/graphql`, {
method: 'POST',
headers: {
Authorization: 'Bearer ' + auth.secret
},
body: JSON.stringify({
query,
variables: variables || {},
operationName: operationName || null
})
});
return await response.json();
}
No comments yet