我是 AWS 的新手。我创建了默认的博客方案。现在我想创建新的博客文章。
创建帖子的片段。
import { API } from "aws-amplify"; import { createPost,createBlog } from './graphql/mutations';
const newPost = await API.graphql({ query: createPost, variables: { input: { "title": "Lorem ipsum dolor sit amet", "blog": /* Provide a Blog instance here */, "comments": [], "author": "Lorem ipsum dolor sit amet" } } });
创建博客的片段
const newBlog = await API.graphql({ query: createBlog, variables: { input: { "name": "Lorem ipsum dolor sit amet", "posts": [] } } });
我的代码:
如何在 createPost 中添加博客值 ` 尝试 { 等待 API.graphql({ 查询:createPost, 变量:{ 输入: { 标题:“Lorem ipsum dolor sit amet”, ** "blog": /* 在这里提供一个 Blog 实例 /,* 作者:“Lorem ipsum dolor sit amet”, }, }, }); } 赶上(错误){}
`