1
0
Fork 0
mirror of https://github.com/terribleplan/next.js.git synced 2024-01-19 02:48:18 +00:00

Fixed auth token not getting refreshed on client cache reset (#5471)

This commit is contained in:
Zach Curtis 2018-10-17 08:52:29 -06:00 committed by Tim Neutkens
parent 6f80581adc
commit 829f4e581c

View file

@ -77,10 +77,15 @@ export default App => {
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: () => props.token
getToken: () => {
if (token) { return token }
return parseCookies().token
}
})
}