Harden community profile identity rendering
Deploy / deploy (push) Successful in 2m9s
CI / Rust Checks (push) Successful in 5m59s
CI / UI Checks (push) Successful in 6s
CI / Deployment Manifests (push) Successful in 3s
CI / Frontend E2E (push) Successful in 4m24s

This commit is contained in:
github-ops
2026-06-19 19:06:48 +00:00
parent db97d37868
commit cbfa412ce0
5 changed files with 114 additions and 25 deletions
+6 -1
View File
@@ -31,11 +31,12 @@
if (response.status === 401 && window.CrankAuth && typeof window.CrankAuth.handleUnauthorized === 'function') {
window.CrankAuth.handleUnauthorized();
}
var looksLikeHtml = /^\s*</.test(text || '');
var message = payload && payload.error
? payload.error.message
: payload && payload.message
? payload.message
: text
: text && !looksLikeHtml
? text
: ('HTTP ' + response.status);
var error = new Error(message);
@@ -44,6 +45,10 @@
throw error;
}
if (text && payload === null) {
throw new Error('Backend returned a non-JSON response');
}
return payload;
}