diff --git a/main.js b/main.js index 7d8357e55..dc6befa2d 100644 --- a/main.js +++ b/main.js @@ -540,8 +540,6 @@ ipcMain.on("open-gql", (event, args) => { }); }); - // IT SEEMS THAT HEADERS ARE NOT READING |HERE - console.log(headers); // creates http connection to host const httpLink = createHttpLink({ uri: reqResObj.url, @@ -585,11 +583,12 @@ ipcMain.on("open-gql", (event, args) => { const variables = reqResObj.request.bodyVariables ? JSON.parse(reqResObj.request.bodyVariables) : {}; + if (reqResObj.request.method === "QUERY") { client - .query({ query: body, variables }) + .query({ query: body, variables, context: headers }) .then((data) => { - event.sender.send("reply-gql", { reqResObj, data }); + event.sender.send("reply-gql", { reqResObj, data }) }) .catch((err) => { // error is actually sent to graphQLController via "errorLink" @@ -597,10 +596,9 @@ ipcMain.on("open-gql", (event, args) => { }); } else if (reqResObj.request.method === "MUTATION") { client - .mutate({ mutation: body, variables }) + .mutate({ mutation: body, variables, context: headers }) .then((data) => { - // return response from GRAPHQL MUTATION - return event.sender.send("reply-gql", { reqResObj, data }) + event.sender.send("reply-gql", { reqResObj, data }) }) .catch((err) => { // error is actually sent to graphQLController via "errorLink" diff --git a/src/client/components/containers/SingleReqResContainer.jsx b/src/client/components/containers/SingleReqResContainer.jsx index 27f443dac..063b8f127 100644 --- a/src/client/components/containers/SingleReqResContainer.jsx +++ b/src/client/components/containers/SingleReqResContainer.jsx @@ -165,7 +165,6 @@ const SingleReqResContainer = (props) => {