in my local http://localhost:3000/graphql query is working like below...
but when I am querying through apollo client its response coming empty
import {InMemoryCache, gql, ApolloClient, HttpLink} from 'apollo-boost';
const cache = new InMemoryCache();
const client = new ApolloClient({
cache,
link: new HttpLink({
uri: 'http://localhost:3000/graphql',
credentials: 'same-origin',
}),
},
});
client
.query({
query: gql`
{
brands {
_id
}
}
`,
})
.then(data => console.log(data))
.catch(error => {
// its coming in this section
console.log(error);
});
Don't know what I am missing. Any help is appreciated Thanks !!!
below are the screenshots, when I am trying to query from frontend side
solved by adding in app.js
global.XMLHttpRequest = global.originalXMLHttpRequest || global.XMLHttpRequest;
global.FormData = global.originalFormData || global.FormData;
if (window.FETCH_SUPPORT) {
window.FETCH_SUPPORT.blob = false;
} else {
global.Blob = global.originalBlob || global.Blob;
global.FileReader = global.originalFileReader || global.FileReader;
}
reference: https://github.com/jhen0409/react-native-debugger/issues/382#issuecomment-544226529