如何访问创建的成分键/值?
这是ingredients
查询:
ingredients{
amount
unit
food{
bls
name
kcal
}
}
mutation {
createRecipe(
data: {
title: "ABC"
author: "XYZ"
level: EASY
ingredients: {amount: 250, unit: GRAMM, food: {name: "Flour", bls: "xxx", kcal: 203}
}
}
Mutation: {
createRecipe: (_, args) => {
const newRecipe = {
title: args.data.title,
author: args.data.author,
level: args.data.level,
ingredients: args.........??????
};
}
}
"data": {
"createRecipe": {
"title": "ABC",
"author": "XYZ",
"level": "EASY",
"ingredients": null,
}
}
如何访问ingredients' amount, unit
然后访问ingredients food name,bls,kcal
并填充gql操场上的配料数组?