如何解决gatsby-source-graphql的问题

时间:2019-10-26 14:47:28

标签: graphql gatsby

我试图将gatsby-source-graphql与我的gatsby JS项目连接。但是我有错误 Cannot query field "alladventures" on type "Query"

这是我的API的gatsby-config代码: https://api.services.activelyme.com/graphql/playground

      resolve: `gatsby-source-graphql`,
      options: {
        // This type will contain remote schema Query type
        typeName: `ALLADVENTURES`,
        // This is the field under which it's accessible
        fieldName: `alladventures`,
        // URL to query from
        url: `https://api.services.activelyme.com/graphql`,
      },
    },

这是我的组件代码

    graphql`
      query {
        alladventures {
          adventures {
            title
          }
        }
        site {
          siteMetadata {
            title
            description
            author
            norwayItems {
              item {
                status {
                  category
                  date
                  season
                }
                title
                location
                userName
                description1
                dates
                show {
                  regular_price
                  promotional_price
                }
                rating {
                  stars
                  review
                  adventures
                }
                mainImage
                guideImage
                link
              }
            }
          }
        }
      }
    `
  )
Schema must contain uniquely named types but contains multiple types named "Query".

Error: Schema must contain uniquely named types but contains multiple types named "Query".

我必须展示冒险经历。但是我每次都会出错。

如果我将此示例与该API配合使用,则一切都很好 https://www.gatsbyjs.org/docs/third-party-graphql/

0 个答案:

没有答案