【发布时间】:2022-04-27 01:32:50
【问题描述】:
我在 next.js 应用程序上使用 Apollo Client 作为 graphql 客户端,这是为我创建客户端的函数:
let client: ApolloClient<any>;
export const __ssrMode__: boolean = typeof window === "undefined";
export const uri: string = "http://localhost:3001/graphql";
const createApolloClient = (): ApolloClient<any> => {
return new ApolloClient({
credentials: "include",
ssrMode: __ssrMode__,
link: createHttpLink({
uri,
credentials: "include",
}),
cache: new InMemoryCache(),
});
};
令人惊讶的是,当我对 graphql 服务器进行更改时,我可以设置 cookie,但是我无法从客户端获取 cookie。可能是什么问题?
【问题讨论】:
标签: express graphql next.js apollo server-side-rendering