0
votes

I have a custom web service api in the web services extension in sap commerce and want to call this api from spartacus for getting some data. I need to add the mapping from spartacus occmodule to this web service api. What are the steps to do this and the best practices?

P.S - I know that we need to create a custom angular module for occ which would have the backend occ url mapped, converter/adapter but not sure how to inject these onto the ootb occmodule in spartacus.

1

1 Answers

0
votes

If you introduce a new API there's no need to replicate the (fairly complex) layering that is used in Spartacus. This layering is mainly in use to provide extension points. If you implement a custom API, you can follow standard best practices to use the API in your angular code.

You should at least delegate the http logic to a separate service. You could keep the state in the service, or use the ngrx store to store the state. It depends on what you're loading and whether the state should be reused in other areas of the application.