共计 620 个字符,预计需要花费 2 分钟才能阅读完成。
最近用 umijs,react 开发我的项目,后端应用 GraphQL 技术数据映射,前端应用 Apollo Client
问题
1. 申请时候总是报错
devScripts.js:6791 Uncaught Error: The error you provided does not contain a stack trace.
Uncaught (in promise) DOMException: The user aborted a request.
- 看到这报错一脸懵逼,百度也没有对应的,还是在 GitHub @apollo/client 官网下 issues
解决
<ApolloProvider client={client}></ApolloProvider>
const abortController = new AbortController();
const httpLink = createHttpLink({uri: `${LOTTERY_API_URL}/graphql`,
fetchOptions: {
mode: 'cors',
signal: abortController.signal,
},
});
const client = new ApolloClient({cache: new InMemoryCache(),
link:httpLink,
});
apollo-client 文档: https://www.apollographql.com…
参考:https://github.com/apollograp…
正文完
发表至: javascript
2022-04-09