【发布时间】:2019-10-05 08:36:55
【问题描述】:
免责声明:我在 SO 上看到了许多其他听起来相同的问题。但是不,这个问题及其背景,一切都不同。不重复。
嘿,我已经按照 https://github.com/zeit/next.js/tree/canary/examples/with-apollo.
除 cookie 外,一切都运行良好。在 CSR 实施的早期,我的withData.js 看起来像这样????
import withApollo from 'next-with-apollo'
import ApolloClient from 'apollo-boost'
function createClient({ headers }) {
return new ApolloClient({
uri: `${process.env.ENDPOINT}/graphql`,
request: operation => {
operation.setContext({
fetchOptions: {
credentials: 'include',
},
headers
})
}
})
}
export default withApollo(createClient)
在上面的示例中,cookie 是由于 request 函数而起作用的。
但在 Next.js 示例中的 SSR 实现中,cookie 不起作用。请帮忙。
我需要将next-with-apollo 与react-apollo SSR 集成。
【问题讨论】:
标签: javascript reactjs apollo react-apollo next.js