删除行后我不知道如何更新表。Apollo-server 用于客户端的后端和中继。我正在尝试使用NODE_DELETE但我不知道我做错了什么
这是删除突变
const mutation = graphql`
mutation DeleteAdMutation(
$id: ID!
) {
deleteEvent(
id: $id
)
{
deletedId
}
}`;
export const DeleteEvent = (input) => {
return new Promise((resolve, reject) => {
commitMutation(
environment,
{
type: 'NODE_DELETE',
deletedIDFieldName: 'deletedId',
mutation,
variables: input,
}
)
});};
deletedId 成功返回,但表中没有任何变化
表查询:
const GetADayTours = graphql`
query GetADayToursQuery(
$type: String!,
$page: Int!,
$row: Int!,
) {
getADayTours(
type: $type,
page: $page,
row: $row,
) {
page
row
total
data{
...on aDayTour{
...Row_row
}
}
}
}`;
export default GetADayTours;
这是行片段:
createFragmentContainer(RowComponent
, {
row: graphql`
fragment Row_row on aDayTour {
_id
id
title
}
`,
});