GraphQL查询(Apollo客户端链接状态)返回空对象{}

时间:2018-08-29 15:52:33

标签: graphql axios apollo react-apollo

查询

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 }) => {....

我收到此警告

enter image description here

并且我的React App中的查询返回{}

我应该在哪里开始讨价还价?

0 个答案:

没有答案