【问题标题】:Gatsby, React Native Web - GraphQL Error Expected type Craft_SectionsEnumGatsby,React Native Web - GraphQL 错误预期类型 Craft_SectionsEnum
【发布时间】:2019-04-02 12:54:38
【问题描述】:

背景

我在 Craft CMS 中创建了一个名为 forVenues 的新部分,并且能够在 CraftQL 测试端点中查询数据,如下所示:

{
  entries(section: [forVenues]) {
    ... on ForVenuesChecklist {
      title
      icon {
        url
      }
      description
    }
  }
}

问题

当我尝试在我的 React Native Web Gatsby 应用程序的 <StaticQuery> 组件中运行查询时,我收到以下错误:

GraphQL Error Expected type Craft_SectionsEnum, found forVenues.

   1 | 
   2 |      {
   3 |          craft {
>  4 |              forVenuesChecklist: entries(section:[forVenues]) {
     |                                                   ^
   5 |                  ... on Craft_ForVenuesChecklist {
   6 |                      title
   7 |                      icon {
   8 |                          url
   9 |                      }
  10 |                      description
  11 |                  }
  12 |              }
  13 |          }
  14 |      }

这表明 Gatsby 项目尚未更新 CMS 中哪些部分可用,但我不知道如何解决此问题。

注意事项

我已经尝试过清除 Gatsby 缓存、重新启动项目、重新启动托管 CMS 并更改我的查询,但均无济于事。任何帮助表示赞赏,谢谢。

【问题讨论】:

    标签: javascript react-native gatsby react-native-web craftcms


    【解决方案1】:

    转到 Settings > CraftQL,单击 API 令牌旁边的 Settings,然后向下滚动到 Queries 并单击刚刚创建的字段以打开令牌范围以公开该值。

    【讨论】:

      猜你喜欢
      • 2020-02-14
      • 2020-06-01
      • 2018-11-27
      • 2019-08-14
      • 2020-06-28
      • 2017-02-15
      • 2020-01-19
      • 2021-02-18
      • 2022-06-21
      相关资源
      最近更新 更多