Reputation: 1
I have a scinario where the price calculation happens at realtime by calling external service.
Coming to Spartacus, what would be the best approach.
Writing custom service to make realtime call for getting pricing data and use(call) the service in Spartacus. Calling the external service with required parameters from Spartacus storefront.
Upvotes: 0
Views: 162
Reputation: 239
Well, you should create a service, that uses your newly created NGRX store (actions, effects, reducer etc..) and your own connector / adapter to call your external API. Then you can subscribe to the state changes to render the response when your the data is received.
I guess with realtime, you mean something that is calculated on an event, or is it something you need to stream / call every x seconds?
Upvotes: 1