@@ -2,16 +2,16 @@ import fetch from 'node-fetch';
2
2
import { GraphQLResponse , AuthHeaderField } from '@slash-graphql/lambda-types' ;
3
3
4
4
export async function graphql ( query : string , variables : Record < string , any > = { } , authHeader : AuthHeaderField ) : Promise < GraphQLResponse > {
5
- const headers : Record < string , string > = { "Content-Type" : "application/json" } ;
6
- if ( authHeader && authHeader . key && authHeader . value ) {
5
+ const headers : Record < string , string > = { "Content-Type" : "application/json" } ;
6
+ if ( authHeader && authHeader . key && authHeader . value ) {
7
7
headers [ authHeader . key ] = headers [ authHeader . value ] ;
8
8
}
9
9
const response = await fetch ( `${ process . env . DGRAPH_URL } /graphql` , {
10
10
method : "POST" ,
11
11
headers,
12
- body : JSON . stringify ( { query, variables} )
12
+ body : JSON . stringify ( { query, variables } )
13
13
} )
14
- if ( response . status !== 200 ) {
14
+ if ( response . status !== 200 ) {
15
15
throw new Error ( "Failed to execute GraphQL Query" )
16
16
}
17
17
return response . json ( ) ;
@@ -36,7 +36,7 @@ async function dqlMutate(mutate: string): Promise<GraphQLResponse> {
36
36
const response = await fetch ( `${ process . env . DGRAPH_URL } /mutate?commitNow=true` , {
37
37
method : "POST" ,
38
38
headers : {
39
- "Content-Type" : "pplication /rdf" ,
39
+ "Content-Type" : "application /rdf" ,
40
40
"X-Auth-Token" : process . env . DGRAPH_TOKEN || ""
41
41
} ,
42
42
body : mutate
0 commit comments