Registration API responses are stringified JSON objects
On POST /api/v1/accounts
, it returns error messages as stringified JSON. I have to JSON.parse(response.data.error)
to do anything with them.
Usually when there's an error
key it's just a regular sentence, like this 403 from /oauth/token
. Here is what I consider a "good" response:
("identifier" is also good for i18n)
And the resulting popup:
However with stringified JSON, we get this:
What I really want to do is update the form with these values and say something generic in the popup. I think ideally the response should resemble this:
{
"error": "Please review the submission",
"identifier": "review_submission",
"fields": {
"captcha": ["Invalid CAPTCHA"]
}
}