AFAIK, currently we do not have anything similar to CurrentProductService for current category.
Looking at the implementation of CurrentProductService you can see that it is using RoutingService and it’s getRouterState() method (picture 1).
After studying the implementation code of currentproductservice, it is found that its implementation principle is to first use routingservice to get the product code of the current page from routerstate, and then use another API, productservice, to read the detailed data of the product.
You can create something similar for current category, because the router state consists of category informations (as seen below on picture 2).
Therefore, we can take a similar idea to extract the category details from the state of the category page:
- param0, param1, param2
More Jerry’s original articles are: “Wang Zixi”: