diff options
| author | Henry Jameson <me@hjkos.com> | 2020-01-28 20:44:13 +0200 |
|---|---|---|
| committer | Henry Jameson <me@hjkos.com> | 2020-01-28 20:44:13 +0200 |
| commit | f0c4bb1193f71cb93546be7e8f41236c4c192f85 (patch) | |
| tree | 26c35a98a8aa80279a1d8d938e41629a774fda37 /src/services/errors/errors.js | |
| parent | b63e679a31a573c30868477f17322d6ed040af58 (diff) | |
| parent | c54111797ae1058e59931b2d1f12e6ab6a6f96a9 (diff) | |
Merge remote-tracking branch 'upstream/develop' into themes-accent
* upstream/develop: (33 commits)
add emoji reactions to changelog
fix emoji reaction classes broken in develop
review changes
Fix password and email update
remove unnecessary anonymous function
Apply suggestion to src/services/api/api.service.js
remove logs/commented code
remove favs count from react button
remove mock data
change emoji reactions to use new format
Added polyfills for EventTarget (needed for Safari) and CustomEvent (needed for IE)
Fix missing TWKN when logged in, but server is set to private mode.
Fix follower request fetching
Add domain mutes to changelog
Implement domain mutes v2
change changelog to reflect actual release history of frontend
Fix #750 , fix error messages and captcha resetting
Optimize Notifications Rendering
update CHANGELOG
Use last seen notif instead of first unseen notif for sinceId
...
Diffstat (limited to 'src/services/errors/errors.js')
| -rw-r--r-- | src/services/errors/errors.js | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/src/services/errors/errors.js b/src/services/errors/errors.js index 590552da..d4cf9132 100644 --- a/src/services/errors/errors.js +++ b/src/services/errors/errors.js @@ -32,12 +32,18 @@ export class RegistrationError extends Error { } if (typeof error === 'object') { + const errorContents = JSON.parse(error.error) + // keys will have the property that has the error, for example 'ap_id', + // 'email' or 'captcha', the value will be an array of its error + // like "ap_id": ["has been taken"] or "captcha": ["Invalid CAPTCHA"] + // replace ap_id with username - if (error.ap_id) { - error.username = error.ap_id - delete error.ap_id + if (errorContents.ap_id) { + errorContents.username = errorContents.ap_id + delete errorContents.ap_id } - this.message = humanizeErrors(error) + + this.message = humanizeErrors(errorContents) } else { this.message = error } |
