我有以下服务等级:
const DeleteUserMutation = gql `
mutation($user_id: ID!) {
deleteUser(id: $user_id) {
id
}
}
`;
@Injectable()
export class UserService {
constructor(private apollo: Apollo) {}
deleteUser(userId: string) {
return this.apollo.mutate({
mutation: DeleteUserMutation,
variables: {
user_id: userId
},
update: (proxy, mutationResult) => {
proxy.writeQuery({
query: DeleteUserMutation,
data: {
deleteUser: {
id: userId,
__typename: 'User'
}
},
variables: {
user_id: userId
}
});
},
})
}
}
我试图从我的服务器中删除一个用户。突变实际上在服务器上成功运行和执行,但缓存永远不会更新。我不确定我update
上面的部分哪里出错了。