const client = new Client({
url: senseopsHTTPServerURL,
exchanges: [
cacheExchange,
authExchange(async utils =>{
let token = initializeAuthState();
return{
addAuthToOperation(operation){
if(!token) return operation;
return utils.appendHeaders(operation,{
Authorization:token,
})
},
}
}),
fetchExchange,
...defaultExchanges,
subscriptionExchange({
forwardSubscription: (operation) => ({
subscribe: (sink) => ({
unsubscribe: wsClient.subscribe(operation, sink),
}),
}),
}),
],
});
It's a front end code. I am using Reactjs.
Using above code how can I set headers to every request it make to GraphQL APIs.