-
Notifications
You must be signed in to change notification settings - Fork 3
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
Make entire response object available in load callback #9
Comments
More background on this: When you call a service method via circuits, you get a very specific set of items passed to your callback. This was originally done to hide some of the ajax complexity, but we've found that there are cases where you will want access to the raw data, and having to wait for us to update the library design isn't useful. So there should be a mechanism where more data is passed to the callback. Calling a circuits method looks something like:
The 'args' param in the success callback should include a |
So, in the exampe presented, we should have:
am I right? |
Yes |
Currently circuits unwraps the main data payload from a response JSON object, and sends it as the first argument to the load/success callback. The second argument gets an object with all of the params, the request, etc. We treat hypermedia links specially, and include them in this second argument as well. However, not all service APIs will have one main payload field on the response, and may want access to these secondary ones (just like "links", but not as a magic property). While it is very convenient to simply get the main payload as the first arg, leaving others unavailable is not desirable. We should add a "response" property to this second argument (to match the "request), so the raw data can be accessed.
Note that it is currently possible to work around this issue by using a "response" type plugin to gain access to the raw data during the lifecycle. This issue is primarily to make this more convenient so it is all available in the same callback.
The text was updated successfully, but these errors were encountered: