Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to access results from REST service? #200

Open
tomsoderlund opened this issue Jan 10, 2019 · 4 comments
Open

How to access results from REST service? #200

tomsoderlund opened this issue Jan 10, 2019 · 4 comments

Comments

@tomsoderlund
Copy link

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?

@lexich
Copy link
Owner

lexich commented Jan 10, 2019

Hi @temnoregg dispatch(rest.actions.entry({id: 1})).then((data) => ...)

@tomsoderlund
Copy link
Author

Thank you @lexich! So simple...

@tomsoderlund
Copy link
Author

A follow-up question, @lexich:

  1. I've figured that the transformer function should always return the complete (sub-)state, right?
  2. It's also the results from this transformer function 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 tomsoderlund reopened this Jan 10, 2019
@lexich
Copy link
Owner

lexich commented Jan 15, 2019

@tomsoderlund I don't understand problem, may be you need to save this ID in another place. Can you show your case in details

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants