【发布时间】:2020-06-14 14:56:48
【问题描述】:
在我的本地 http://localhost:3000/graphql 查询中,如下所示...
但是当我通过 apollo 客户端查询时,它的响应为空
import {InMemoryCache, gql, ApolloClient, HttpLink} from 'apollo-boost';
const cache = new InMemoryCache();
const client = new ApolloClient({
cache,
link: new HttpLink({
uri: 'http://localhost:3000/graphql',
credentials: 'same-origin',
}),
},
});
client
.query({
query: gql`
{
brands {
_id
}
}
`,
})
.then(data => console.log(data))
.catch(error => {
// its coming in this section
console.log(error);
});
不知道我错过了什么。任何帮助表示感谢谢谢!!!
以下是我尝试从前端查询时的屏幕截图
【问题讨论】:
-
我们希望在您的控制台上查看错误
-
@Abdelhedihlel 更新了错误截图
-
原始响应?长度 246?
-
@xadm 没明白
-
比较请求正文(带操场)...和错误的响应正文
标签: graphql apollo react-apollo apollo-client express-graphql