-
Hey, i'm trying to use urql ssr with next but i can't find a way to pass the cookies back! Any suggestions? this is my UrqlClient config: export const createUrqlClient = (ssrExchange: any): any => ({
url: "http://localhost:80/graphql",
fetchOptions: {
credentials: "include" as const,
},
headers: {
cookie: ctx?.req?.headers?.cookie
},
exchanges: [
dedupExchange,
cacheExchange({
// ... removed for ease of reading :)
}),
ssrExchange,
fetchExchange
]
}) i tried to add the export default withUrqlClient(createUrqlClient, {ssr: false}) (Login); |
Beta Was this translation helpful? Give feedback.
Answered by
HarryET
Sep 28, 2020
Replies: 2 comments 6 replies
-
The request context, i.e. |
Beta Was this translation helpful? Give feedback.
6 replies
-
Here is the fix: export const createUrqlClient = (ssrExchange: SSRExchange, ctx?: NextPageContext): any => ({
url: "http://localhost:80/graphql",
fetchOptions: {
credentials: "include" as const,
headers: {
cookie: ctx?.req?.headers?.cookie
}
},
exchanges: [
devtoolsExchange,//! REMOVE IN PROD
dedupExchange,
cacheExchange({
// ... removed for ease of reading :)
}),
ssrExchange,
fetchExchange
]
}) |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
HarryET
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Here is the fix: