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:
parent
6f80581adc
commit
829f4e581c
|
@ -77,10 +77,15 @@ export default App => {
|
||||||
|
|
||||||
constructor (props) {
|
constructor (props) {
|
||||||
super(props)
|
super(props)
|
||||||
|
|
||||||
|
const { token } = props
|
||||||
// `getDataFromTree` renders the component first, the client is passed off as a property.
|
// `getDataFromTree` renders the component first, the client is passed off as a property.
|
||||||
// After that rendering is done using Next's normal rendering pipeline
|
// After that rendering is done using Next's normal rendering pipeline
|
||||||
this.apolloClient = initApollo(props.apolloState, {
|
this.apolloClient = initApollo(props.apolloState, {
|
||||||
getToken: () => props.token
|
getToken: () => {
|
||||||
|
if (token) { return token }
|
||||||
|
return parseCookies().token
|
||||||
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue