当前位置: 代码迷 >> 综合 >> Error: fetch-mock: No fallback response defined for POST to /graphql
  详细解决方案

Error: fetch-mock: No fallback response defined for POST to /graphql

热度:97   发布时间:2024-02-09 00:01:35.0

环境: "@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

  相关解决方案