Commit a7b6ffa9 authored by Janek Rahrt's avatar Janek Rahrt Committed by Tim Neutkens

Fix ssr auth bug and dependency problems (#5543)

* fix graphql dep

* fix ssr auth bug

* fix linting issues
parent e382be65
......@@ -22,9 +22,8 @@ export default App => {
static async getInitialProps (ctx) {
const { Component, router, ctx: { req, res } } = ctx
const token = parseCookies(req).token
const apollo = initApollo({}, {
getToken: () => token
getToken: () => parseCookies(req).token
})
ctx.ctx.apolloClient = apollo
......@@ -70,20 +69,16 @@ export default App => {
return {
...appProps,
apolloState,
token
apolloState
}
}
constructor (props) {
super(props)
const { token } = props
// `getDataFromTree` renders the component first, the client is passed off as a property.
// After that rendering is done using Next's normal rendering pipeline
this.apolloClient = initApollo(props.apolloState, {
getToken: () => {
if (token) { return token }
return parseCookies().token
}
})
......
......@@ -12,7 +12,7 @@
"apollo-boost": "^0.1.6",
"apollo-link-context": "^1.0.8",
"cookie": "^0.3.1",
"graphql": "^0.13.2",
"graphql": "14.0.2",
"isomorphic-unfetch": "^2.0.0",
"next": "latest",
"prop-types": "^15.6.1",
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment