环境: "@apollo/client": "^3.1.2","graphql": "^15.3.0","react": "^16.13.1",
在连接是一直报错
const client = new ApolloClient({uri: '/graphql',cache: new InMemoryCache(),
});client.query({query: gql`{user(id:1) {name,}}`}).then(result => console.log(result));
报错信息:
分析:使用fetch-mock模拟数据,访问被拦截
解决方式:移除fetch-mock