I'm using react native fetch to make a post http request with graphql data to a graphql server endpoint. When starting up my graphql server and calling fetch with a POST in my react native app, I'm getting the following error:
TypeError: Network Request Failed at XMLHttpRequest in react native app
Request code
let graphqlServer = config.graphQLServerUrl;
const graphQLFetcher = (graphQLParams, requestType, token) => {
let body = null; //earlier i used var body =' '; //blank value --null & blank makes a different
let headers = null;
body = graphQLParams;
headers = {
'Accept': 'application/json',
'Content-Type': 'application/graphql',
'Authorization': 'Bearer ' + token
};
return fetch(graphqlServer, {
method: requestType,
headers: headers,
body: graphQLParams,
});
};
Data
qraphQLParams
query {
login(userName: ${credentials.userName}, passWord: ${credentials.passWord})
}
,
Any ideas?