Hi Team,
I'm using an AjaxStore. One of my rest calls fails and there is an error msg in the response payload.
But I'm unable to access it in the code.
In afterRequest listener ,the props param is as shown in screenshot.
Any pointers to how can i access response payload?
I need to get the message shown in network tab but the props parameter doesnot contain it
Support Forum
- Attachments
-
- response.png (88.97 KiB) Viewed 151 times
-
- props.png (70.16 KiB) Viewed 151 times
It looks like you are sending a plain text from backend.
Try sending in JSON format, for example:
return res.status(400).json({
error: "Something went wrong!!",
});
which can be then seen on frontend
store.on(
"afterRequest",
({ exception, action, exceptionType, response, json }) => {
console.log(response.parsedJson.error);
}
);
Arsalan
Developer Advocate
Hi,
Try to put debugger into "afterRequest" handler and learn what's in response
object. Find where is your text placed and use it.
I believe that's easy to get. It might be in response
as is.
Please post vanilla related questions in vanilla forums, not in ExtJS forums. It will allow us to reply faster.
Thank you!
All the best,
Alex Lazarev
How to ask for help? Please read our Support Policy
We do not write the code in bounds of forum support. If you need help with development, contact us via bryntum.com/services