(please mind the way I wrote the question.. I tried my luck first with AI..)
In nordcraft what would be the best way/system to reload APIs from one component to the other?
For example I have an SPA, every page is technically a component inside the main page, and I also have all the main dialogs in the main page.
Now for example when I want to create a new contact, the contact page is a component inside the main page, I have there a button, on click I pass on an event to the main page that would open the add contact dialog (popup modal). Now when I save the new contract I need to refresh the API with the list of contacts to be able to see the new contact straight away without the user having to manually refreshing the browser.
Now what I am currently doing is, I have to do a hack.
In the contacts component I have an attribute 'reload contacts' that is default to 0, then a do on attribute change- reload contacts API.
Now when the user saves the new contact I increment a variable 'reload contacts api' which is linked to the attribute of the contact component. What happens then is because it updates the attribute, it will refresh the API.
But this is very hacky and inefficient.
I have a ton of these use cases and I need a better way to handle it.
Any ideas of how to do this?