Created
July 27, 2018 09:49
-
-
Save klashxx/c43771ab4f307ea62a6accfe2cc9b96f to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const httpLink = createHttpLink({ | |
uri: '/graphql', | |
credentials: 'same-origin', | |
}); | |
const authLink = setContext((_, { headers }) => { | |
return { | |
headers: { | |
...headers, | |
'Accept': 'application/json', | |
'Content-Type': 'application/json', | |
'X-CSRFToken': Cookies.get('csrftoken'), | |
} | |
} | |
}); | |
const client = new ApolloClient({ | |
link: authLink.concat(httpLink), | |
cache: new InMemoryCache() | |
}); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment