blob: 755f4c13bda1ac63b756226f6696b642e1117d9f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
import withApollo from 'next-with-apollo';
import ApolloClient from 'apollo-boost';
import { endpoint } from '../config';
function createClient({ headers }) {
return new ApolloClient({
uri: process.env.NODE_ENV === 'development' ? endpoint : endpoint,
request: operation => {
operation.setContext({
fetchOptions: {
credentials: 'include',
},
headers,
});
},
});
}
export default withApollo(createClient);
|