From a7b6ffa9148310e1ba9c7cbbf404e82c43b17e5e Mon Sep 17 00:00:00 2001 From: Janek Rahrt Date: Sun, 28 Oct 2018 21:13:28 +0100 Subject: [PATCH] Fix ssr auth bug and dependency problems (#5543) * fix graphql dep * fix ssr auth bug * fix linting issues --- examples/with-apollo-auth/lib/withApollo.js | 9 ++------- examples/with-apollo-auth/package.json | 2 +- 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/examples/with-apollo-auth/lib/withApollo.js b/examples/with-apollo-auth/lib/withApollo.js index 5b6b1d23..49d27286 100644 --- a/examples/with-apollo-auth/lib/withApollo.js +++ b/examples/with-apollo-auth/lib/withApollo.js @@ -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 } }) diff --git a/examples/with-apollo-auth/package.json b/examples/with-apollo-auth/package.json index 18706084..4d3f6664 100644 --- a/examples/with-apollo-auth/package.json +++ b/examples/with-apollo-auth/package.json @@ -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",