Replies: 1 comment
-
If someone is interested, I noticed that export const getServerSideProps = (async context => {
const { id: postId } = context.query;
const headers = context.req.headers;
const accessToken = headers['app_header'];
graphQLClient.setHeader('new_header', accessToken); <--- this line
const data = await graphQLClient.request(query, { postId });
return data;
}) satisfies GetServerSideProps; Closing this issue :) |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
We want to prefetch data by using
getServerSideProps
. Do we really need to pass headers directly tographql.request
function? Is it possible that following code may work?I wouldn't like to pass
headers
as second argument to the function, since we usereact-query
( and we would need to disable eslint deeps rule ).Beta Was this translation helpful? Give feedback.
All reactions