opencomponents / oc

OpenComponents, serverless in the front-end world for painless micro-frontends delivery
https://opencomponents.github.io/
MIT License
1.43k stars 122 forks source link

Add support for Actions #1346

Closed ricardo-devis-agullo closed 11 months ago

ricardo-devis-agullo commented 1 year ago

This adds minimal support for Actions.

What's an action?

An action is a call to a OC Server just to get additional data. This comes from the need that some OCs need to call themselves again to get more data, and right now, every time you call, you need to pass all the initial parameters, even though they might not be needed (if we think them as routes, each route might have different needs in terms of input).

So this PR creates a new property action to the component. data on the POST endpoint (the one used by oc.getData on the browser), that when used, it will:

Ideally the templates can abstract this so the server side can already wrap this logic in a seamless way for the user (the logic of an action-aware server), but this is the minimal work in core so that can happen.