当前位置: 首页 > Web前端 > HTML

apollo-client报错DOMException-Theuserabortedarequest

时间:2023-04-02 11:59:45 HTML

最近用umijs和react开发了一个项目,后端使用GraphQL技术数据映射,前端使用ApolloClient问题1.请求devScripts.js时总是报错:6791UncaughtError:Theerroryouprovideddoesnotcontain堆栈跟踪。未捕获(承诺)DOMException:用户中止了请求。看到这个错误我愣了,百度也没反应。还在GitHub@apollo/client官网下issue解决constabortController=newAbortController();consthttpLink=createHttpLink({uri:`${LOTTERY_API_URL}/graphql`,fetchOptions:{mode:'cors',signal:abortController.signal,},});constclient=newApolloClient({cache:newInMemoryCache(),link:httpLink,});apollo-client文档:https://www.apollographql.com...参考:https://github.com/apollograp...