GraphQL客户端订阅无法正常工作

时间:2018-06-18 08:21:30

标签: amazon-web-services aws-appsync aws-amplify

GraphQL客户端订阅无法正常工作(React Js)

 componentDidMount = async () => {
    const subscriptionDeleteProduct = API.graphql(graphqlOperation(SubscribeProductDelete)).subscribe({
    next: (eventData) =>{
        this.handleSubscriptionDelete(eventData)},
        error:(error)=>{
            console.log('error',error)

        }
});

const subscriptionCreateProduct = API.graphql(graphqlOperation(SubscribeProductCreate)).subscribe({
    next: (eventData) => {console.log('subscriptionCreateProduct');
    },
    error:(error)=>{
        console.log('error',error)

    }
});

const subscriptionUpdateProduct = API.graphql(graphqlOperation(SubscribeProductUpdate)).subscribe({
    next: (eventData) => {this.handleSubscriptionUpdate(eventData)},
    error:(error)=>{
        console.log('error',error)
    }
});

   }

某些组件订阅创建和删除,他们工作,但订阅更新不起作用 我检查AWS AppSync上的查询,它的工作原理 对于创建代码,我已经检查了Appsync,并且该过程正常工作。

如何解决问题?

0 个答案:

没有答案