查询
const GET_MEMBER = gql`
query getMembers {
getMembers @client {
firstname
lastname
__typename
}
}
`
export { GET_MEMBER }
解析器:
export default {
resolvers: {
Query: {
getMembers: async (_, variables, { cache }) => {
try {
const res = await apiClient.get('/contacts')
return { ...res.data, __typename: 'Member' }
} catch (e) {
throw e
}
},
},
apiClient是axios的实例
反应应用程序:
<Query query={GET_MEMBER}>
{({ loading, error, data }) => {....
我收到此警告
并且我的React App中的查询返回{}
我应该在哪里开始讨价还价?