我该如何查询一对一的关系查询aws
这是我尝试进行查询的方式,但是我不知道该怎么做,
const CategoriesProducts = async ()=>{
const fetchData = await API.graphql({
query: listProductCategories, variables: {id: '1cb76030-0ee0-432a-b3ee-4087d33eaaf3'}
})
setCategoryProduct(fetchData.data.listProductCategories.items)}
这是我的架构
”查询
这是ListProductCategories查询
当我在TE AWS Console中进行查询时,我获得了结果,但是我无法在Visual Studio Code中执行相同的查询
谢谢您的支持
how can i make this query in the screenshot from the client side.
this is how i tried to do the query, but i don't know what to do next
const CategoriesProducts = async ()=>{
const fetchData = await API.graphql({
query: listProductCategories, variables: {id: '1cb76030-0ee0-432a-b3ee-4087d33eaaf3'}
})
setCategoryProduct(fetchData.data.listProductCategories.items)}
this is my schema
and this is the getProductCategories queries
and this is the listProductCategories queries
i get the result when i make the query in te aws console, but i can't perform the same query in visual studio code
thank you for your support
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
在您的GraphQL目录中由AWS-CLI自动生成,创建新文件,
casure-ceries.js
:定义以下自定义gruber graphql查询
code> code> code-queries.js
:现在您应该能够在代码中导入
list ProductCategoriesByCategoryId ,并以此为单位:
In your graphql directory auto-generated by aws-cli, create new file,
custom-queries.js
:define the following custom graphql query inside
custom-queries.js
:Now you should be able to import
ListProductCategoriesByCategoryId
in your code and call it like this :