File tree 1 file changed +5
-3
lines changed
examples/with-apollo-auth/lib
1 file changed +5
-3
lines changed Original file line number Diff line number Diff line change @@ -22,8 +22,9 @@ export default App => {
22
22
23
23
static async getInitialProps ( ctx ) {
24
24
const { Component, router, ctx : { req, res } } = ctx
25
+ const token = parseCookies ( req ) . token
25
26
const apollo = initApollo ( { } , {
26
- getToken : ( ) => parseCookies ( req ) . token
27
+ getToken : ( ) => token
27
28
} )
28
29
29
30
ctx . ctx . apolloClient = apollo
@@ -69,7 +70,8 @@ export default App => {
69
70
70
71
return {
71
72
...appProps ,
72
- apolloState
73
+ apolloState,
74
+ token
73
75
}
74
76
}
75
77
@@ -78,7 +80,7 @@ export default App => {
78
80
// `getDataFromTree` renders the component first, the client is passed off as a property.
79
81
// After that rendering is done using Next's normal rendering pipeline
80
82
this . apolloClient = initApollo ( props . apolloState , {
81
- getToken : ( ) => parseCookies ( ) . token
83
+ getToken : ( ) => props . token
82
84
} )
83
85
}
84
86
You can’t perform that action at this time.
0 commit comments