summaryrefslogtreecommitdiffstats
path: root/frontend/lib/withData.js
diff options
context:
space:
mode:
authorWes Bos <wesbos@gmail.com>2018-05-16 10:54:08 -0400
committerWes Bos <wesbos@gmail.com>2018-05-16 10:54:08 -0400
commit802b65cfd634305f62d88cb57c54f8c053701d27 (patch)
tree12a06778d21a8b14bade3ccc8c9dd75f59f97e4a /frontend/lib/withData.js
parent3f9b14e3c1d7f47d9b3e48b94b3b5bf2c722205e (diff)
SSR Auth WIP
Diffstat (limited to 'frontend/lib/withData.js')
-rw-r--r--frontend/lib/withData.js10
1 files changed, 8 insertions, 2 deletions
diff --git a/frontend/lib/withData.js b/frontend/lib/withData.js
index 0696333..9bd22f0 100644
--- a/frontend/lib/withData.js
+++ b/frontend/lib/withData.js
@@ -5,16 +5,22 @@ import { LOCAL_STATE_QUERY } from '../queries/queries.graphql';
const client = new ApolloClient({
uri: process.env.NODE_ENV === 'development' ? 'http://localhost:4444' : 'http://localhost:4444',
- ssrMode: !process.browser, // Disables forceFetch on the server (so queries are only run once)
+ // ssrMode: !process.browser, // Disables forceFetch on the server (so queries are only run once)
// TODO this is a bug: https://github.com/apollographql/apollo-client/issues/3265
fetchOptions: {
credentials: 'include',
},
- request: async operation => {
+ request: async (operation, forward) => {
operation.setContext({
fetchOptions: {
credentials: 'include',
},
+ headers: {
+ haha: `lol${Date.now()}`,
+ cookie: '',
+ // TODO: This cookie needs to come from the SSR
+ // cookie:'token=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VySWQiOiJjamY0ZWtqcm55ZGQ0MDkxNnhweXEweGVqIiwiaWF0IjoxNTI2NDc4NzY2fQ.LJbLhKZ6j5d3ntDvaBR4V-4rFEPv_pzJiIhZ84WkO6A',
+ },
});
},
clientState: {