How to access results from REST service?
Can I somehow immediately access the results from the REST service?
E.g. the example:
dispatch(rest.actions.entry({id: 1}));
If my REST server returns the ID of the new entry, how can I use that in my frontend app?
Hi @temnoregg dispatch(rest.actions.entry({id: 1})).then((data) => ...)
Thank you @lexich! So simple...
A follow-up question, @lexich:
- I've figured that the
transformerfunction should always return the complete (sub-)state, right? - It's also the results from this
transformerfunction that I receive in.then((data) => ...)above, right?
I have a problem right now in a "delete" action; my REST service returns the ID of a deleted item, my front-end wants to have this ID, but since the transformer function needs the complete item list, this ID is lost.
@tomsoderlund I don't understand problem, may be you need to save this ID in another place. Can you show your case in details