首页 > 解决方案 > React Apollo 客户端不发送 cookie

问题描述

我已经阅读了一些与我相关的其他问题,但无法得到答案。

import { ApolloClient, createHttpLink, InMemoryCache, ApolloProvider } from '@apollo/client';

const link = createHttpLink({
  uri: 'https://example.com/graphql',
  credentials: 'include'
});

const client = new ApolloClient({
  link,
  cache: new InMemoryCache(),
});

ReactDOM.render(
  <React.StrictMode>
      <ApolloProvider client={client} >
          <App />
      </ApolloProvider>
  </React.StrictMode>, 
  document.getElementById('root')
);

这是我在所有反应应用程序中使用的代码,在这个应用程序中,我试图在本地主机中使用我的 graphql 后端,所以我认为问题就在那里。我在问题中收到此警告:

问题

那么有谁知道这个问题或者我该如何解决它?

标签: reactjsreact-apollo

解决方案


推荐阅读