SAP Commerce Cloud Product Revie
2021-10-19 本文已影响0人
华山令狐冲
点了 Write Review 按钮之后,调用 ProductReviewService 的 add 方法:
![](https://img.haomeiwen.com/i2085791/773bda2305efb687.png)
该方法 dispatch 一个新的 action:
![](https://img.haomeiwen.com/i2085791/e3be5626b6fc7254.png)
![](https://img.haomeiwen.com/i2085791/db2c66e236b472e0.png)
![](https://img.haomeiwen.com/i2085791/be892d43c81c4cbe.png)
override the ProductReviewService to dispatch a custom action to an effect they would create with the logic they need.
搜索 POST_PRODUCT_REVIEW, 看看接收方是谁。
答案是 『ProductReviewsEffect:接收了该 Action 之后,调用 productReviewsConnector,消费 OCC API 添加 post,待添加成功后,返回新的 Action 对象 ProductActions.PostProductReviewSuccess,其中包含了 ReviewResponse.
![](https://img.haomeiwen.com/i2085791/3ce00b52906af8fe.png)
同样在该 effect 内部,接收到 POST_PRODUCT_REVIEW_SUCCESS 之后,抛出 Thank you for review 的成功消息。
![](https://img.haomeiwen.com/i2085791/048c37c759f7c883.png)
更多Jerry的原创文章,尽在:"汪子熙":
![](https://img.haomeiwen.com/i2085791/97c4752c0e619c44.png)