【发布时间】:2019-07-23 13:02:22
【问题描述】:
我正在尝试使用 next.js 构建应用程序,前端是 apollo 客户端,后端是 graphql-yoga 和 prisma,但我在将 apollo 客户端扩展到 chrome 时遇到问题,它无法获取我的日期。这就是它的外观。 Failed to fetch error picture。还有代码:
import withApollo from "next-with-apollo";
import ApolloClient from "apollo-boost";
import { endpoint } from "../config";
function createClient({ headers }) {
return new ApolloClient({
uri: process.env.NODE_ENV === "development" ? endpoint : endpoint,
request: operation => {
operation.setContext({
fetchOptions: {
credentials: "include",
connectToDevTools: true
},
headers
});
}
});
}
export default withApollo(createClient);
我知道这一定是我的愚蠢失误,但我找不到。感谢所有尝试帮助我的人。
【问题讨论】:
标签: javascript reactjs next.js google-chrome-devtools react-apollo